mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-12-01 01:52:30 +01:00
For #2465, select latest provider evidence with the existing scope index rather than ranking every retained payload. Preserve history and evidence validation. Share complete, failure-preserving backup alert evaluation across PVE/PBS/mock polls and expose unavailable reads through the existing deduplicated system warning; keep existing age alerts until a complete read. Contract-Neutral: Application query and existing system-alert behaviour only; no API, schema, resource identity, agent lifecycle, entitlement or notification contract shape changes. The new warning uses the existing open system-alert type, identity and metadata contract. Semantic contracts and connected verification are included. Change-source: pulse-maintainer
29 lines
1.0 KiB
Go
29 lines
1.0 KiB
Go
package alerts
|
|
|
|
import "testing"
|
|
|
|
func TestBackupEvaluationSystemAlertUsesExistingIdentityAndDeduplication(t *testing.T) {
|
|
m := NewManagerWithDataDir(t.TempDir())
|
|
defer m.Stop()
|
|
input := SystemAlertInput{Type: BackupEvaluationAlertType, Level: AlertLevelWarning,
|
|
Fingerprint: "recovery-rollups-unavailable", Message: "Backup-age alerts were not evaluated."}
|
|
if !m.RaiseSystemAlert(input) {
|
|
t.Fatal("first failure not raised")
|
|
}
|
|
if m.RaiseSystemAlert(input) {
|
|
t.Fatal("repeated failure re-notified")
|
|
}
|
|
active := m.GetActiveAlerts()
|
|
if len(active) != 1 || active[0].ID != SystemAlertID(BackupEvaluationAlertType) ||
|
|
active[0].ResourceID != "" || active[0].Metadata["systemAlert"] != true {
|
|
t.Fatalf("system projection=%+v", active)
|
|
}
|
|
m.CleanupAlertsForNodes(map[string]bool{})
|
|
if len(m.GetActiveAlerts()) != 1 {
|
|
t.Fatal("node cleanup erased the evaluator outage")
|
|
}
|
|
if !m.ClearSystemAlert(BackupEvaluationAlertType) || len(m.GetActiveAlerts()) != 0 {
|
|
t.Fatal("recovery did not clear the warning")
|
|
}
|
|
}
|