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.
Many of tests related to evaluation of Prometheus alerts fail because the function
check_alert_list()
inocs_ci.utility.prometheus
is broken:It initializes itself by setting the
target_alerts
array with all alerts carying the passedlabel
. However, within the loop over the passedstates
it is overwriting thetarget_alerts
array. As a consequence, if passing astates
array, for example[ 'pending', 'firing' ]
, the second pass through the loop, whenstate
is'firing'
will fail on assertion error, because after the previous pass, only the'pending'
alerts are contained in thetarget_alerts
array when it is inspected. Therefore the resultingtarget_alerts
is quaranteed to be empty which is definitely wrong.