test(ariadne): cover VM trend filters
This commit is contained in:
parent
604b198534
commit
19372c8a9a
@ -228,6 +228,32 @@ def test_vm_trend_helpers(monkeypatch) -> None:
|
||||
assert vm_trends._pods_phase_trends()["1h"]["running"]["avg"] == 2.0
|
||||
|
||||
|
||||
def test_vm_trend_helpers_filter_malformed_vectors(monkeypatch) -> None:
|
||||
monkeypatch.setattr(
|
||||
vm_trends,
|
||||
"_vm_vector",
|
||||
lambda _expr: [
|
||||
"bad",
|
||||
{"metric": {"namespace": "apps"}, "value": 5.0},
|
||||
{"metric": {"namespace": 3, "job_name": "bad"}, "value": 4.0},
|
||||
{"metric": {"namespace": "apps", "job_name": "api"}, "value": 3.0},
|
||||
],
|
||||
)
|
||||
assert vm_trends._job_failure_trend("1h") == [{"namespace": "apps", "job": "api", "value": 3.0}]
|
||||
|
||||
monkeypatch.setattr(
|
||||
vm_trends,
|
||||
"_vm_vector",
|
||||
lambda _expr: [
|
||||
"bad",
|
||||
{"metric": {"namespace": "apps"}, "value": 5.0},
|
||||
{"metric": {"namespace": "apps", "pod": 3}, "value": 4.0},
|
||||
{"metric": {"namespace": "apps", "pod": "api"}, "value": 3.0},
|
||||
],
|
||||
)
|
||||
assert vm_trends._pod_reason_entries("expr", 5) == [{"namespace": "apps", "pod": "api", "value": 3.0}]
|
||||
|
||||
|
||||
def test_vm_usage_helpers(monkeypatch) -> None:
|
||||
monkeypatch.setattr(vm_usage, "_vm_scalar", lambda _expr: 10.0)
|
||||
monkeypatch.setattr(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user