@@ -21,15 +21,60 @@ class AlertModelFactory(ModelFactory):
2121 "alerts_models, expected_result" ,
2222 [
2323 pytest .param (
24- [AlertModelFactory .build (name = "alert1" ), AlertModelFactory .build (name = "alert2" )],
25- [Result (state = State .CRIT , summary = "Status: Alerts present" )],
24+ [
25+ AlertModelFactory .build (name = "alert1" , acknowledge = False , suppress = False ),
26+ AlertModelFactory .build (name = "alert2" , acknowledge = False , suppress = False ),
27+ ],
28+ [
29+ Result (
30+ state = State .CRIT ,
31+ summary = "Unhandled alerts present, see details" ,
32+ details = "alert1\n alert2" ,
33+ )
34+ ],
2635 id = "alerts present" ,
2736 ),
2837 pytest .param (
2938 [],
30- [Result (state = State .OK , summary = "Status: OK " )],
39+ [Result (state = State .OK , summary = "No alerts present " )],
3140 id = "no alerts present" ,
3241 ),
42+ pytest .param (
43+ [
44+ AlertModelFactory .build (
45+ name = "alert1" , acknowledge = True , acknowledger = "hhirsch" , suppress = False
46+ ),
47+ AlertModelFactory .build (
48+ name = "alert2" , acknowledge = False , suppress = True , suppressor = "hhirsch"
49+ ),
50+ ],
51+ [
52+ Result (
53+ state = State .OK ,
54+ summary = "Alerts present, but all acknowledged or suppressed, see details" ,
55+ details = "alert1, acknowledged by hhirsch\n alert2, suppressed by hhirsch" ,
56+ )
57+ ],
58+ id = "alerts suppressed" ,
59+ ),
60+ pytest .param (
61+ [
62+ AlertModelFactory .build (
63+ name = "alert2" , acknowledge = False , suppress = True , suppressor = "hhirsch"
64+ ),
65+ AlertModelFactory .build (
66+ name = "alert1" , acknowledge = False , acknowledger = "hhirsch" , suppress = False
67+ ),
68+ ],
69+ [
70+ Result (
71+ state = State .CRIT ,
72+ summary = "Unhandled alerts present, see details" ,
73+ details = "alert1\n alert2, suppressed by hhirsch" ,
74+ )
75+ ],
76+ id = "one alert not suppressed (show it first)" ,
77+ ),
3378 ],
3479)
3580def test_check_netapp_ontap_status (
0 commit comments