test(ariadne): cover cluster attention edges
This commit is contained in:
parent
236f2a5318
commit
102eaf8d92
@ -104,12 +104,7 @@ def _workload_attention_entries(workloads_health: dict[str, Any]) -> list[dict[s
|
|||||||
return entries
|
return entries
|
||||||
|
|
||||||
|
|
||||||
def _build_attention_ranked(
|
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]]:
|
||||||
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 = (
|
entries = (
|
||||||
_node_attention_entries(node_context)
|
_node_attention_entries(node_context)
|
||||||
+ _pvc_attention_entries(metrics)
|
+ _pvc_attention_entries(metrics)
|
||||||
|
|||||||
@ -244,6 +244,20 @@ def test_profile_builders_filter_bad_nodes_and_workload_nodes() -> None:
|
|||||||
assert workload_profiles[1]["nodes_top"] == []
|
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:
|
def test_health_helpers_handle_clean_and_malformed_inputs() -> None:
|
||||||
bullets = health._health_bullets(
|
bullets = health._health_bullets(
|
||||||
{"pods_running": 1, "pods_pending": 0, "pods_failed": 0},
|
{"pods_running": 1, "pods_pending": 0, "pods_failed": 0},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user