From 6fc68c20c57c12e74fa4550b80ffbbbe5066f9d0 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 9 Nov 2024 14:06:43 +0300 Subject: [PATCH] don't forget to test alerts themselves --- misc/checks.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/misc/checks.py b/misc/checks.py index 4dcda77..8fa1c64 100644 --- a/misc/checks.py +++ b/misc/checks.py @@ -201,6 +201,15 @@ def raid_check() -> list[alerts.Alert]: ) continue + if IS_TESTING: + alert_list.append( + alerts.Alert( + alert_type=alerts.AlertType.RAID, + message=f"Test alert: LV {lv} health is {lv_attr.health}", + severity=alerts.Severity.INFO, + ) + ) + match lv_attr.health: case LVAttr.Health.PARTIAL: alert_list.append( @@ -255,7 +264,7 @@ def disk_wearout_check() -> list[alerts.Alert]: logging.error(traceback.format_exc()) continue - if wearout_reading.current_reading < wearout_reading.threshold_reading: + if IS_TESTING or wearout_reading.current_reading < wearout_reading.threshold_reading: match wearout_reading.indicator: case WearoutIndicator.REALLOCATED_SECTORS: message = f"Disk {disk['name']} has reallocated sectors (curr {wearout_reading.current_reading}, thresh {wearout_reading.threshold_reading})"