test(ariadne): cover cluster attention edges

This commit is contained in:
codex 2026-04-21 04:21:57 -03:00
parent 236f2a5318
commit 102eaf8d92
2 changed files with 15 additions and 6 deletions

View File

@ -104,12 +104,7 @@ def _workload_attention_entries(workloads_health: dict[str, Any]) -> list[dict[s
return entries
def _build_attention_ranked(
metrics: dict[str, Any],
node_context: list[dict[str, Any]],
pod_issues: dict[str, Any],
workloads_health: dict[str, Any],
) -> list[dict[str, Any]]:
def _build_attention_ranked(metrics: dict[str, Any], node_context: list[dict[str, Any]], pod_issues: dict[str, Any], workloads_health: dict[str, Any]) -> list[dict[str, Any]]:
entries = (
_node_attention_entries(node_context)
+ _pvc_attention_entries(metrics)

View File

@ -244,6 +244,20 @@ def test_profile_builders_filter_bad_nodes_and_workload_nodes() -> None:
assert workload_profiles[1]["nodes_top"] == []
def test_attention_filters_edge_entries(monkeypatch) -> None:
assert attention._node_attention_entries([None, {"node": ""}, {"node": "quiet"}]) == []
monkeypatch.setattr(attention, "_pvc_pressure_entries", lambda _metrics: [None, {"namespace": "apps", "pvc": "data", "used_percent": 90.0}])
assert attention._pvc_attention_entries({}) == [
{
"kind": "pvc",
"target": "apps/data",
"score": 2.0,
"reasons": ["usage 90.0%"],
}
]
def test_health_helpers_handle_clean_and_malformed_inputs() -> None:
bullets = health._health_bullets(
{"pods_running": 1, "pods_pending": 0, "pods_failed": 0},