fix(ops): wait for metrics bridge reload

This commit is contained in:
ogt
2026-07-11 20:31:04 +08:00
parent f55a257766
commit 8af5cf3d54
2 changed files with 49 additions and 2 deletions

View File

@@ -157,6 +157,27 @@ def test_metrics_canary_requires_ewoooc_product_markers():
assert _parse_metrics_canary(wrong_exporter) == ("200", False)
def test_metrics_canary_waits_for_new_nginx_worker(monkeypatch):
from services import metrics_edge_controlled_apply_service as service
outputs = iter([
"forbidden\n__EWOOOC_HTTP_STATUS__:403",
(
"momo_app_info 1\nmomo_app_health 1\nmomo_database_up 1"
"\n__EWOOOC_HTTP_STATUS__:200"
),
])
monkeypatch.setattr(
service,
"_run",
lambda _command: type("Completed", (), {"stdout": next(outputs)})(),
)
monkeypatch.setattr(service.time, "sleep", lambda _seconds: None)
assert service._wait_metrics_canary(["curl"], 10) == ("200", True, 2)
def test_target_health_rejects_stale_scrape_url():
from services.metrics_edge_controlled_apply_service import _target_health_from_payload