Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

test: Add critical-only grouped alert template case

rcourtman4e90e6efb2c6
diff --git a/internal/notifications/email_template_test.go b/internal/notifications/email_template_test.go
index 219d667a21..1dab690ecb 100644
--- a/internal/notifications/email_template_test.go
+++ b/internal/notifications/email_template_test.go
@@ -606,6 +606,32 @@ func TestEmailTemplate(t *testing.T) {
expectSingleSubject: true,
subjectContains: "Warning",
},
+ {
+ name: "multiple critical alerts only uses grouped template",
+ alerts: []*alerts.Alert{
+ {
+ ID: "alert-1",
+ Level: "critical",
+ Type: "cpu",
+ ResourceName: "vm-1",
+ Value: 95.5,
+ Threshold: 90.0,
+ StartTime: time.Now(),
+ },
+ {
+ ID: "alert-2",
+ Level: "critical",
+ Type: "memory",
+ ResourceName: "vm-2",
+ Value: 98.0,
+ Threshold: 90.0,
+ StartTime: time.Now(),
+ },
+ },
+ isSingle: false,
+ expectSingleSubject: false,
+ subjectContains: "2 Critical alerts",
+ },
}
for _, tt := range tests {