-
Notifications
You must be signed in to change notification settings - Fork 820
Add Alertmanager Integration Tests and Static File Backend #1686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
jtlisi
wants to merge
34
commits into
cortexproject:master
from
grafana:20190916_file_backed_alertmanager
Closed
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
27c77c7
refactor alertmanager storage and add static file alert store
jtlisi 858d1ec
add integration test for alertmananger
jtlisi 6d3405b
revert client
jtlisi 056bc51
delete unneeded files
jtlisi 5497b46
refactor to match rebase
jtlisi 71b73ed
fix struct import
jtlisi 0b04e5b
fix interface change
jtlisi c4935b2
remove unused function
jtlisi ffcc546
remove unused config
jtlisi 0ac7460
instantiate map
jtlisi 4409f94
address linting issues around file/local nomenclature
jtlisi caf9db7
ensure user alertmanagers are deleted
jtlisi f2e7846
rename addNewConfigs to syncConfigs
jtlisi 5315819
rename server to store
jtlisi 513c1ad
fix comments to use store language
jtlisi 7a0ddb0
remove unused file
jtlisi 26de24d
refactor logic when setting map
jtlisi 1c036ee
add unit tests for syncing alertmanager configs
jtlisi 2086938
goformat test file
jtlisi c6e8c3a
fix mild race condition
jtlisi 2932615
update docs
jtlisi 4eaefac
remove mutex and stop linearly
jtlisi 33dc8c5
revert change to dispatcher
jtlisi fae9c12
revert alermanager to original file and remove delete test case
jtlisi d461ee6
fix alertmanager test
jtlisi 765581b
refactor per PR comments
jtlisi bf4b4d2
add Go based integration test
jtlisi cbd8c18
rebase alertmanager integration test
jtlisi d96c619
check errors
jtlisi ef86964
update vendored deps
jtlisi 5002d5b
revert alertmanager upgrade
jtlisi 4c1214a
fix goimports lint
jtlisi aeca3b5
revert debugging vendor change
jtlisi e7eb89f
update docs
jtlisi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/cortexproject/cortex/integration/framework" | ||
) | ||
|
||
func TestAlertmanager(t *testing.T) { | ||
s, err := framework.NewScenario() | ||
require.NoError(t, err) | ||
defer s.Shutdown() | ||
|
||
AlertmanagerConfigs := map[string]string{ | ||
"-alertmanager.storage.local.path": "/integration/alertmanager_test_fixtures/", | ||
"-alertmanager.storage.type": "local", | ||
"-alertmanager.web.external-url": "http://localhost/api/prom", | ||
} | ||
|
||
// Start Cortex components | ||
require.NoError(t, s.StartAlertmanager("alertmanager", AlertmanagerConfigs, "")) | ||
require.NoError(t, s.Service("alertmanager").WaitMetric(80, "cortex_alertmanager_configs", 1)) | ||
|
||
c, err := framework.NewClient("", "", s.Endpoint("alertmanager", 80), "user-1") | ||
require.NoError(t, err) | ||
|
||
status, err := c.GetAlertmanagerStatus(context.Background()) | ||
require.NoError(t, err) | ||
|
||
// Ensure the returned status config matches alertmanager_test_fixtures/user-1.yaml | ||
require.NotNil(t, status) | ||
require.Equal(t, "example_receiver", status.ConfigJSON.Route.Receiver) | ||
require.Len(t, status.ConfigJSON.Route.GroupByStr, 1) | ||
require.Equal(t, "example_groupby", status.ConfigJSON.Route.GroupByStr[0]) | ||
require.Len(t, status.ConfigJSON.Receivers, 1) | ||
require.Equal(t, "example_receiver", status.ConfigJSON.Receivers[0].Name) | ||
require.NoError(t, s.StopService("alertmanager")) | ||
} |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
route: | ||
receiver: "example_receiver" | ||
group_by: ["example_groupby"] | ||
receivers: | ||
- name: "example_receiver" |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an entry to
CHANGELOG.md
explaning all changes (this is a config breaking change).