Skip to content

Commit

Permalink
Inverting logic for alerts priority
Browse files Browse the repository at this point in the history
  • Loading branch information
rpdevmp committed Dec 5, 2024
1 parent 3395f76 commit a037d8e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/rptest/redpanda_cloud_tests/observe_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,16 @@ def test_cloud_observe(self):

for alert in alerts:
alert_message = f"alert firing for cluster: {alert.labels.grafana_folder} / {alert.labels.alertname}"
if "high priority" in alert_message.lower():
self.logger.error(f"High priority - {alert_message}")
high_priority_alerts.append(alert_message)
# Treat all alerts not explicitly marked as "low priority" as high priority
if "low priority" in alert_message.lower():
self.logger.warn(f"Low priority alert - {alert_message}")
else:
self.logger.warning(f"Low priority - {alert_message}")
self.logger.error(f"High priority alert - {alert_message}")
high_priority_alerts.append(alert_message)

# Fail the test if high-priority alerts are present
assert not high_priority_alerts, (
f"Test failed due to high-priority alerts:\n{high_priority_alerts}"
f"Test failed due to potential high-priority alerts:\n{high_priority_alerts}"
)

self.logger.info("Cloud observe test completed successfully.")

0 comments on commit a037d8e

Please sign in to comment.