mirror of
https://github.com/prometheus/alertmanager
synced 2024-12-25 07:32:19 +00:00
Add test cases for silences with negative matchers
Signed-off-by: Koki Kato <koki.kato1994@gmail.com>
This commit is contained in:
parent
b9aae07a73
commit
b5ddc5d638
@ -183,7 +183,36 @@ func TestCheckSilenceMatchesFilterLabels(t *testing.T) {
|
||||
[]*labels.Matcher{createLabelMatcher("label", "value", labels.MatchEqual)},
|
||||
false,
|
||||
},
|
||||
|
||||
{
|
||||
[]*silencepb.Matcher{createSilenceMatcher("label", "value", silencepb.Matcher_NOT_EQUAL)},
|
||||
[]*labels.Matcher{createLabelMatcher("label", "value", labels.MatchNotEqual)},
|
||||
true,
|
||||
},
|
||||
{
|
||||
[]*silencepb.Matcher{createSilenceMatcher("label", "value", silencepb.Matcher_NOT_REGEXP)},
|
||||
[]*labels.Matcher{createLabelMatcher("label", "value", labels.MatchNotRegexp)},
|
||||
true,
|
||||
},
|
||||
{
|
||||
[]*silencepb.Matcher{createSilenceMatcher("label", "value", silencepb.Matcher_EQUAL)},
|
||||
[]*labels.Matcher{createLabelMatcher("label", "value", labels.MatchNotEqual)},
|
||||
false,
|
||||
},
|
||||
{
|
||||
[]*silencepb.Matcher{createSilenceMatcher("label", "value", silencepb.Matcher_REGEXP)},
|
||||
[]*labels.Matcher{createLabelMatcher("label", "value", labels.MatchNotRegexp)},
|
||||
false,
|
||||
},
|
||||
{
|
||||
[]*silencepb.Matcher{createSilenceMatcher("label", "value", silencepb.Matcher_NOT_EQUAL)},
|
||||
[]*labels.Matcher{createLabelMatcher("label", "value", labels.MatchNotRegexp)},
|
||||
false,
|
||||
},
|
||||
{
|
||||
[]*silencepb.Matcher{createSilenceMatcher("label", "value", silencepb.Matcher_NOT_REGEXP)},
|
||||
[]*labels.Matcher{createLabelMatcher("label", "value", labels.MatchNotEqual)},
|
||||
false,
|
||||
},
|
||||
{
|
||||
[]*silencepb.Matcher{
|
||||
createSilenceMatcher("label", "(foo|bar)", silencepb.Matcher_REGEXP),
|
||||
|
Loading…
Reference in New Issue
Block a user