fix(ops): enforce Prometheus runtime identity
Some checks failed
CD Pipeline / deploy (push) Has been cancelled

This commit is contained in:
ogt
2026-07-11 20:21:45 +08:00
parent 98ded2373a
commit 66b6ca04a4
2 changed files with 40 additions and 2 deletions

View File

@@ -144,6 +144,24 @@ def test_prometheus_config_sha_detects_stale_container_mount(tmp_path: Path, mon
assert container_sha == stale_sha
def test_prometheus_identity_verifier_requires_same_image_and_data_volume():
from services.metrics_edge_controlled_apply_service import (
_prometheus_identity_preserved,
)
before = {"image_id": "image-a", "data_volume": "volume-a"}
assert _prometheus_identity_preserved(before, dict(before)) is True
assert _prometheus_identity_preserved(
before,
{"image_id": "image-b", "data_volume": "volume-a"},
) is False
assert _prometheus_identity_preserved(
before,
{"image_id": "image-a", "data_volume": "volume-b"},
) is False
def test_render_rejects_incomplete_templates():
from services.metrics_edge_controlled_apply_service import (
render_nginx_config,