Add unified notification center

This commit is contained in:
maxim
2026-07-31 21:17:48 +03:00
parent 030e1fdc7f
commit ec20550c3b
4 changed files with 193 additions and 6 deletions

18
alerts_test.go Normal file
View File

@@ -0,0 +1,18 @@
package main
import "testing"
func TestEvaluateAlerts(t *testing.T) {
metrics := dashboardMetrics{
Memory: MemoryMetrics{UsagePercent: 91},
Storage: StorageMetrics{UsagePercent: 96},
Backups: BackupMetrics{}, Guests: GuestsMetrics{},
}
alerts := evaluateAlerts(metrics)
if len(alerts) != 2 {
t.Fatalf("ожидалось два уведомления, получено: %+v", alerts)
}
if alerts[0].Severity != "critical" || alerts[1].Severity != "warning" {
t.Fatalf("неверная сортировка уведомлений: %+v", alerts)
}
}