Minor fix

This commit is contained in:
TwinProduction 2021-02-18 23:47:53 -05:00
parent 0a145da912
commit cdb5ba080a

View File

@ -71,8 +71,8 @@ func TestAlertProvider_ToCustomAlertProvider(t *testing.T) {
func TestAlertProvider_buildHTTPRequestWithCustomPlaceholder(t *testing.T) { func TestAlertProvider_buildHTTPRequestWithCustomPlaceholder(t *testing.T) {
const ( const (
ExpectedURL = "http://example.com/service-name?event=MYTEST&description=alert-description" ExpectedURL = "http://example.com/service-name?event=test&description=alert-description"
ExpectedBody = "service-name,alert-description,MYTEST" ExpectedBody = "service-name,alert-description,test"
) )
customAlertProvider := &AlertProvider{ customAlertProvider := &AlertProvider{
URL: "http://example.com/[SERVICE_NAME]?event=[ALERT_TRIGGERED_OR_RESOLVED]&description=[ALERT_DESCRIPTION]", URL: "http://example.com/[SERVICE_NAME]?event=[ALERT_TRIGGERED_OR_RESOLVED]&description=[ALERT_DESCRIPTION]",
@ -80,7 +80,7 @@ func TestAlertProvider_buildHTTPRequestWithCustomPlaceholder(t *testing.T) {
Headers: nil, Headers: nil,
Placeholders: map[string]map[string]string{ Placeholders: map[string]map[string]string{
"ALERT_TRIGGERED_OR_RESOLVED": { "ALERT_TRIGGERED_OR_RESOLVED": {
"resolved": "MYTEST", "RESOLVED": "test",
}, },
}, },
} }
@ -101,12 +101,10 @@ func TestAlertProvider_GetAlertStatePlaceholderValueDefaults(t *testing.T) {
Headers: nil, Headers: nil,
Placeholders: nil, Placeholders: nil,
} }
if customAlertProvider.GetAlertStatePlaceholderValue(true) != "RESOLVED" { if customAlertProvider.GetAlertStatePlaceholderValue(true) != "RESOLVED" {
t.Error("expected here actually RESOLVED") t.Error("expected RESOLVED, got", customAlertProvider.GetAlertStatePlaceholderValue(true))
} }
if customAlertProvider.GetAlertStatePlaceholderValue(false) != "TRIGGERED" { if customAlertProvider.GetAlertStatePlaceholderValue(false) != "TRIGGERED" {
t.Error("expected here actually TRIGGERED") t.Error("expected TRIGGERED, got", customAlertProvider.GetAlertStatePlaceholderValue(false))
} }
} }