fix(ops): honor host load controller readback paths
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 57s
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 57s
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled
This commit is contained in:
@@ -875,6 +875,60 @@ def test_sustained_load_controller_routes_control_plane_family_pressure(tmp_path
|
||||
assert "scripts/ops/" not in payload["commands"]["post_apply_verifier"]
|
||||
|
||||
|
||||
def test_sustained_load_controller_honors_custom_readback_paths(tmp_path: Path) -> None:
|
||||
metrics_file = tmp_path / "host.prom"
|
||||
metrics_file.write_text(
|
||||
"\n".join(
|
||||
[
|
||||
'awoooi_host_runaway_process_monitor_up{host="188",mode="read_only"} 1',
|
||||
'awoooi_host_load5_per_core{host="188"} 0.40',
|
||||
'awoooi_host_swap_used_ratio{host="188"} 0.1',
|
||||
'awoooi_host_runaway_process_remediation_authorized{host="188"} 0',
|
||||
]
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
docker_file = tmp_path / "docker.prom"
|
||||
docker_file.write_text(
|
||||
'docker_container_cpu_cores{host="188",container_name="momo-scheduler"} 0.70\n',
|
||||
encoding="utf-8",
|
||||
)
|
||||
ps_file = tmp_path / "ps.txt"
|
||||
ps_file.write_text("100 1 100 3600 5.0 0.0 python python worker.py\n", encoding="utf-8")
|
||||
script_dir = tmp_path / "deployed-scripts"
|
||||
|
||||
result = subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
str(CONTROLLER_PATH),
|
||||
"--host",
|
||||
"188",
|
||||
"--metrics-file",
|
||||
str(metrics_file),
|
||||
"--docker-stats-file",
|
||||
str(docker_file),
|
||||
"--script-dir",
|
||||
str(script_dir),
|
||||
"--ps-file",
|
||||
str(ps_file),
|
||||
"--json",
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
|
||||
assert result.returncode == 0
|
||||
payload = json.loads(result.stdout)
|
||||
assert payload["classification"] == "observing_load_within_threshold"
|
||||
assert payload["readback"]["metrics_file"] == str(metrics_file)
|
||||
assert payload["readback"]["docker_stats_file"] == str(docker_file)
|
||||
assert payload["readback"]["script_dir"] == str(script_dir)
|
||||
assert str(metrics_file) in payload["commands"]["post_apply_verifier"]
|
||||
assert str(docker_file) in payload["commands"]["post_apply_verifier"]
|
||||
assert str(script_dir / "host-sustained-load-controller.py") in payload["commands"]["post_apply_verifier"]
|
||||
assert "/home/wooo/node_exporter_textfiles" not in payload["commands"]["post_apply_verifier"]
|
||||
|
||||
|
||||
def test_sustained_load_evidence_emits_sanitized_gitea_recommendation(tmp_path: Path) -> None:
|
||||
ps_file = tmp_path / "ps.txt"
|
||||
ps_file.write_text(
|
||||
|
||||
Reference in New Issue
Block a user