Add unified notification center
This commit is contained in:
18
alerts_test.go
Normal file
18
alerts_test.go
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user