File tree Expand file tree Collapse file tree 1 file changed +2
-8
lines changed
stackhpc_cloud_tests/monitoring Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -76,14 +76,8 @@ def test_prometheus_alerts_inactive(prom):
76
76
]
77
77
78
78
def alert_is_ignored (alert , alerts_to_ignore ):
79
- alert_items = alert .items ()
80
- for alert_to_ignore in alerts_to_ignore :
81
- alert_to_ignore_items = alert_to_ignore .items ()
82
- # alert has more items than alerts_to_ignore
83
- # so here we can return True if alert_to_ignore is a subset of alerts
84
- if alert_to_ignore_items <= alert_items :
85
- return True
86
- return False
79
+ # Check if any of the "ignore cases" match the alert
80
+ return any (alert_to_ignore .items () <= alert .items () for alert_to_ignore in alerts_to_ignore )
87
81
88
82
alerts = [ alert for alert in alerts if not alert_is_ignored (alert ["labels" ], aio_alerts_to_ignore ) ]
89
83
assert len (alerts ) == 0
You can’t perform that action at this time.
0 commit comments