All checks were successful
CD Pipeline / workflow-shape (push) Successful in 2s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 2m31s
CD Pipeline / build-and-deploy (push) Successful in 15m18s
AWOOOI Harbor 110 Local Repair / workflow-shape (push) Successful in 1s
AWOOOI Harbor 110 Local Repair / harbor-110-local-repair (push) Successful in 22s
CD Pipeline / post-deploy-checks (push) Successful in 5m35s
41 lines
1.6 KiB
Python
41 lines
1.6 KiB
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[3]
|
|
SCRIPT = ROOT / "scripts" / "ops" / "deploy-alertmanager-runtime-scrape.sh"
|
|
|
|
|
|
def test_controlled_scrape_apply_has_check_rollback_and_independent_verifier() -> None:
|
|
text = SCRIPT.read_text(encoding="utf-8")
|
|
|
|
assert 'TRACE_ID="${TRACE_ID:?TRACE_ID is required}"' in text
|
|
assert 'RUN_ID="${RUN_ID:?RUN_ID is required}"' in text
|
|
assert 'WORK_ITEM_ID="${WORK_ITEM_ID:?WORK_ITEM_ID is required}"' in text
|
|
assert "promtool check config" in text
|
|
assert "writes_performed=0" in text
|
|
assert "rollback_receipt" in text
|
|
assert "terminal=rollback_failed ready=false" in text
|
|
assert "flock -n 9" in text
|
|
assert '!= "${CANDIDATE_SHA}"' in text
|
|
assert '!= "${SOURCE_SHA}"' in text
|
|
assert "alertmanager_notification_requests_total" in text
|
|
assert "alertmanager_notification_requests_failed_total" in text
|
|
assert 'integration="webhook"' in text
|
|
assert "target_label: receiver_contract" in text
|
|
assert "replacement: 'awoooi-webhook'" in text
|
|
assert text.count('receiver_contract="awoooi-webhook"') >= 2
|
|
assert "two_scrapes_up" in text
|
|
assert "delivery_series_count" in text
|
|
|
|
|
|
def test_controlled_scrape_apply_never_replaces_the_full_live_config() -> None:
|
|
text = SCRIPT.read_text(encoding="utf-8")
|
|
|
|
assert "BEGIN AWOOOI ALERTMANAGER RUNTIME DELIVERY TRUTH" in text
|
|
assert "job_name: 'alertmanager-runtime'" in text
|
|
assert "targets: ['alertmanager:9093']" in text
|
|
assert "legacy_pattern" in text
|
|
assert "k8s/monitoring/prometheus.yml" not in text
|