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 singleAlertTemplate type coverage tests

rcourtmanfca712430ea8
diff --git a/internal/notifications/email_template_test.go b/internal/notifications/email_template_test.go
index 1dab690ecb..5311477f9f 100644
--- a/internal/notifications/email_template_test.go
+++ b/internal/notifications/email_template_test.go
@@ -632,6 +632,40 @@ func TestEmailTemplate(t *testing.T) {
expectSingleSubject: false,
subjectContains: "2 Critical alerts",
},
+ {
+ name: "io type alert formats as I/O",
+ alerts: []*alerts.Alert{
+ {
+ ID: "alert-io",
+ Level: "warning",
+ Type: "io",
+ ResourceName: "storage-pool",
+ Value: 150.0,
+ Threshold: 100.0,
+ StartTime: time.Now(),
+ },
+ },
+ isSingle: true,
+ expectSingleSubject: true,
+ subjectContains: "I/O",
+ },
+ {
+ name: "custom type alert uses title case",
+ alerts: []*alerts.Alert{
+ {
+ ID: "alert-custom",
+ Level: "critical",
+ Type: "network_latency",
+ ResourceName: "router-1",
+ Value: 500.0,
+ Threshold: 100.0,
+ StartTime: time.Now(),
+ },
+ },
+ isSingle: true,
+ expectSingleSubject: true,
+ subjectContains: "router-1",
+ },
}
for _, tt := range tests {