mirror of
https://github.com/dredx/prole.git
synced 2026-09-24 19:04:31 +00:00
- persist and load DB master password via Ansible Vault bootstrap flow - enforce knoe-system service namespace and explicit app/db kubecontext targeting - improve OpenBao/CNPG deploy reliability and logging; add retries/readiness diagnostics - tighten reset/delete cluster behavior and expand installer/deploy pipeline test coverage Co-authored-by: Junie <junie@jetbrains.com>
55 lines
2.3 KiB
Python
55 lines
2.3 KiB
Python
from pathlib import Path
|
|
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def test_gke_cnpg_manifest_uses_autopilot_baseline_profile() -> None:
|
|
manifest = (REPO_ROOT / "deploy" / "gcp" / "gke" / "knoe-db.yaml").read_text(encoding="utf-8")
|
|
|
|
assert "podAntiAffinityType: preferred" in manifest
|
|
assert " nodeSelector:\n workload: db" in manifest
|
|
assert "\n nodeSelector:\n workload: db\n" not in manifest
|
|
assert 'cpu: "100m"' in manifest
|
|
assert 'memory: "128Mi"' in manifest
|
|
assert 'cpu: "500m"' in manifest
|
|
assert 'memory: "512Mi"' in manifest
|
|
assert "metadata:" in manifest and "namespace: knoe-db-0" in manifest
|
|
assert "CREATE EXTENSION IF NOT EXISTS postgis_topology;" in manifest
|
|
assert "postgis_topology SCHEMA" not in manifest
|
|
assert "barmanObjectStore" not in manifest
|
|
|
|
|
|
def test_init_cnpg_gke_default_namespace_matches_manifest_namespace() -> None:
|
|
script = (REPO_ROOT / "etc" / "init_cnpg_gke.sh").read_text(encoding="utf-8")
|
|
|
|
assert 'CNPG_NAMESPACE="${CNPG_NAMESPACE:-knoe-db-0}"' in script
|
|
|
|
|
|
def test_init_cnpg_gke_waits_for_service_account_and_retries_bucket_iam() -> None:
|
|
script = (REPO_ROOT / "etc" / "init_cnpg_gke.sh").read_text(encoding="utf-8")
|
|
|
|
assert "Waiting for service account propagation" in script
|
|
assert "for i in $(seq 1 6); do" in script
|
|
assert "WARN: IAM grant failed" in script
|
|
assert "--from-file=ca.key=" in script
|
|
|
|
|
|
def test_init_cnpg_gke_steps_down_storage_classes_when_quota_is_exhausted() -> None:
|
|
script = (REPO_ROOT / "etc" / "init_cnpg_gke.sh").read_text(encoding="utf-8")
|
|
|
|
assert 'CNPG_STORAGE_CLASS_ORDER="${CNPG_STORAGE_CLASS_ORDER:-premium-rwo,ssd,premium,standard-rwo,garage-hdd,standard,dynamic-rwo}"' in script
|
|
assert "resolve_storage_class_candidates" in script
|
|
assert "storage_class_is_compatible" in script
|
|
assert "SSD_TOTAL_GB" in script
|
|
assert "stepping down" in script
|
|
assert "CNPG provisioning selected storageClass=" in script
|
|
|
|
|
|
def test_init_cnpg_gke_manifest_rendering_only_substitutes_required_vars() -> None:
|
|
script = (REPO_ROOT / "etc" / "init_cnpg_gke.sh").read_text(encoding="utf-8")
|
|
|
|
assert "resolve_knoe_db_image_tag" in script
|
|
assert "envsubst '${ARTIFACT_REGISTRY} ${KNOE_DB_IMAGE_TAG}'" in script
|
|
assert "envsubst '${GCP_PROJECT_ID}'" in script
|