fix(cd): keep database verifier non-disruptive
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / build-and-deploy (push) Has been cancelled
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / tests (push) Has been cancelled

This commit is contained in:
ogt
2026-07-14 16:22:21 +08:00
parent 2fbc0feec7
commit 3933b0f397
3 changed files with 96 additions and 38 deletions

View File

@@ -237,6 +237,9 @@ def test_workload_database_bootstrap_keeps_secret_values_off_output() -> None:
assert "pid <> pg_backend_pid()" in script
assert "for preflight_attempt in 1 2 3" in script
assert "preflight_attempts_exhausted=3" in script
assert '"connection_headroom_below_required"' in script
assert 'error_code = "workload_database_preflight_failed"' in script
assert '"error_code": error_code' in script
assert 'text("SELECT pg_sleep(0.25)")' in script
assert "api) printf '12'" in script
assert "worker) printf '8'" in script
@@ -278,8 +281,17 @@ def test_cd_uses_live_spec_rollback_and_non_mutating_post_verifier() -> None:
assert "API_PUBLIC_READINESS_ATTEMPTS" in workflow
assert "API_HTTP_CONCURRENCY_ATTEMPTS" in workflow
assert "API sequential readiness permanent HTTP status" in workflow
assert "events/dossier/coverage?project_id=awoooi&limit=1" in workflow
assert "platform/cicd/events?project_id=awoooi&limit=1" in workflow
assert "api/v1/health/ready" in workflow
assert "events/dossier/coverage?project_id=awoooi&limit=1" not in workflow
assert "api/v1/platform/cicd/events" in workflow
assert "?project_id=awoooi&limit=1" in workflow
assert "concurrency_urls = (db_probe_url,) * 8" in workflow
assert "concurrency_urls = urls * 6" not in workflow
assert "API_RESTART_COUNT_BEFORE=$(api_restart_total)" in workflow
assert "API_RESTART_COUNT_AFTER=$(api_restart_total)" in workflow
assert '"$API_PROBE_RESTART_FREE" != "true"' in workflow
assert "API concurrency probe destabilized rollout" in workflow
assert "api_http_probe_restart_free" in workflow
assert workflow.index("API_HTTP_CONCURRENCY_VERIFIED=$(python3") < workflow.index(
"$KUBECTL create configmap awoooi-executor-boundary-verification"
)
@@ -329,7 +341,7 @@ def test_cd_api_readiness_retries_http_503_then_runs_all_200_concurrency(
monkeypatch: pytest.MonkeyPatch,
capsys: pytest.CaptureFixture[str],
) -> None:
responses = [503, 200, 200, 200, *([200] * 12)]
responses = [503, 200, *([200] * 8)]
calls: list[str] = []
def fake_urlopen(url: str, *, timeout: int) -> _FakeHTTPResponse:
@@ -358,7 +370,10 @@ def test_cd_api_readiness_retries_http_503_then_runs_all_200_concurrency(
output = capsys.readouterr()
assert output.out.strip() == "true"
assert "api_sequential_readiness=ready;attempt=2" in output.err
assert len(calls) == 16
assert len(calls) == 10
assert calls[0].startswith("https://awoooi.wooo.work/api/v1/health/ready|")
assert calls[1].startswith("https://awoooi.wooo.work/api/v1/health/ready|")
assert all("platform/cicd/events" in call for call in calls[2:])
assert responses == []
@@ -392,7 +407,8 @@ def test_cd_api_readiness_exhaustion_stops_before_green_receipt_write(
output = capsys.readouterr()
assert output.out == ""
assert namespace["receipt_write_reached"] is False
assert len(calls) == 6
assert len(calls) == 3
assert all("api/v1/health/ready" in call for call in calls)
def test_cd_api_readiness_permanent_http_error_fails_without_retry(