fix(ops): reconcile Prometheus bind mount
Some checks failed
CD Pipeline / deploy (push) Has been cancelled

This commit is contained in:
ogt
2026-07-11 20:17:36 +08:00
parent 61fb34c1d8
commit 98ded2373a
3 changed files with 116 additions and 3 deletions

View File

@@ -126,6 +126,24 @@ def test_prometheus_write_preserves_bind_mount_inode(tmp_path: Path):
assert config.read_text(encoding="utf-8") == "global:\n scrape_interval: 30s\n"
def test_prometheus_config_sha_detects_stale_container_mount(tmp_path: Path, monkeypatch):
from services import metrics_edge_controlled_apply_service as service
config = tmp_path / "prometheus.yml"
config.write_text("candidate", encoding="utf-8")
stale_sha = "0" * 64
monkeypatch.setattr(
service,
"_run",
lambda _command: type("Completed", (), {"stdout": f"{stale_sha} config"})(),
)
host_sha, container_sha = service._prometheus_config_sha(config)
assert host_sha != container_sha
assert container_sha == stale_sha
def test_render_rejects_incomplete_templates():
from services.metrics_edge_controlled_apply_service import (
render_nginx_config,