mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-04-28 03:20:11 +00:00
test: Add singleAlertTemplate type coverage tests
Cover io type (formats as "I/O") and custom type (uses titleCase) branches that were previously untested in the email template.
This commit is contained in:
parent
f4397b1512
commit
fca712430e
1 changed files with 34 additions and 0 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue