-
-
Notifications
You must be signed in to change notification settings - Fork 455
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(alerting): Implement alert-level provider overrides
Fixes #96
- Loading branch information
Showing
48 changed files
with
634 additions
and
519 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,15 +12,15 @@ func TestAlertDefaultProvider_IsValid(t *testing.T) { | |
if invalidProvider.IsValid() { | ||
t.Error("provider shouldn't have been valid") | ||
} | ||
invalidProviderWithOneKey := AlertProvider{From: "[email protected]", To: "[email protected]", AccessKeyID: "1"} | ||
invalidProviderWithOneKey := AlertProvider{Config: Config{From: "[email protected]", To: "[email protected]", AccessKeyID: "1"}} | ||
if invalidProviderWithOneKey.IsValid() { | ||
t.Error("provider shouldn't have been valid") | ||
} | ||
validProvider := AlertProvider{From: "[email protected]", To: "[email protected]"} | ||
validProvider := AlertProvider{Config: Config{From: "[email protected]", To: "[email protected]"}} | ||
if !validProvider.IsValid() { | ||
t.Error("provider should've been valid") | ||
} | ||
validProviderWithKeys := AlertProvider{From: "[email protected]", To: "[email protected]", AccessKeyID: "1", SecretAccessKey: "1"} | ||
validProviderWithKeys := AlertProvider{Config: Config{From: "[email protected]", To: "[email protected]", AccessKeyID: "1", SecretAccessKey: "1"}} | ||
if !validProviderWithKeys.IsValid() { | ||
t.Error("provider should've been valid") | ||
} | ||
|
@@ -30,8 +30,8 @@ func TestAlertProvider_IsValidWithOverride(t *testing.T) { | |
providerWithInvalidOverrideGroup := AlertProvider{ | ||
Overrides: []Override{ | ||
{ | ||
To: "[email protected]", | ||
Group: "", | ||
Config: Config{To: "[email protected]"}, | ||
Group: "", | ||
}, | ||
}, | ||
} | ||
|
@@ -41,21 +41,23 @@ func TestAlertProvider_IsValidWithOverride(t *testing.T) { | |
providerWithInvalidOverrideTo := AlertProvider{ | ||
Overrides: []Override{ | ||
{ | ||
To: "", | ||
Group: "group", | ||
Config: Config{To: ""}, | ||
Group: "group", | ||
}, | ||
}, | ||
} | ||
if providerWithInvalidOverrideTo.IsValid() { | ||
t.Error("provider integration key shouldn't have been valid") | ||
} | ||
providerWithValidOverride := AlertProvider{ | ||
From: "[email protected]", | ||
To: "[email protected]", | ||
Config: Config{ | ||
From: "[email protected]", | ||
To: "[email protected]", | ||
}, | ||
Overrides: []Override{ | ||
{ | ||
To: "[email protected]", | ||
Group: "group", | ||
Config: Config{To: "[email protected]"}, | ||
Group: "group", | ||
}, | ||
}, | ||
} | ||
|
@@ -134,7 +136,9 @@ func TestAlertProvider_getToForGroup(t *testing.T) { | |
{ | ||
Name: "provider-no-override-specify-no-group-should-default", | ||
Provider: AlertProvider{ | ||
To: "[email protected]", | ||
Config: Config{ | ||
To: "[email protected]", | ||
}, | ||
Overrides: nil, | ||
}, | ||
InputGroup: "", | ||
|
@@ -143,7 +147,9 @@ func TestAlertProvider_getToForGroup(t *testing.T) { | |
{ | ||
Name: "provider-no-override-specify-group-should-default", | ||
Provider: AlertProvider{ | ||
To: "[email protected]", | ||
Config: Config{ | ||
To: "[email protected]", | ||
}, | ||
Overrides: nil, | ||
}, | ||
InputGroup: "group", | ||
|
@@ -152,11 +158,13 @@ func TestAlertProvider_getToForGroup(t *testing.T) { | |
{ | ||
Name: "provider-with-override-specify-no-group-should-default", | ||
Provider: AlertProvider{ | ||
To: "[email protected]", | ||
Config: Config{ | ||
To: "[email protected]", | ||
}, | ||
Overrides: []Override{ | ||
{ | ||
Group: "group", | ||
To: "[email protected]", | ||
Group: "group", | ||
Config: Config{To: "[email protected]"}, | ||
}, | ||
}, | ||
}, | ||
|
@@ -166,11 +174,13 @@ func TestAlertProvider_getToForGroup(t *testing.T) { | |
{ | ||
Name: "provider-with-override-specify-group-should-override", | ||
Provider: AlertProvider{ | ||
To: "[email protected]", | ||
Config: Config{ | ||
To: "[email protected]", | ||
}, | ||
Overrides: []Override{ | ||
{ | ||
Group: "group", | ||
To: "[email protected]", | ||
Group: "group", | ||
Config: Config{To: "[email protected]"}, | ||
}, | ||
}, | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.