red-hat-storage / ocs-ci

https://ocs-ci.readthedocs.io/en/latest/
MIT License
109 stars 166 forks source link

Prometheus related tests fails because check_alert_list() function is broken #9978

Open schaefm-ibm opened 3 months ago

schaefm-ibm commented 3 months ago

Many of tests related to evaluation of Prometheus alerts fail because the function check_alert_list() in ocs_ci.utility.prometheus is broken:

It initializes itself by setting the target_alerts array with all alerts carying the passed label. However, within the loop over the passed states it is overwriting the target_alerts array. As a consequence, if passing a states array, for example [ 'pending', 'firing' ], the second pass through the loop, when state is 'firing' will fail on assertion error, because after the previous pass, only the 'pending' alerts are contained in the target_alerts array when it is inspected. Therefore the resulting target_alerts is quaranteed to be empty which is definitely wrong.

github-actions[bot] commented 2 weeks ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs.