Skip to content

Commit

Permalink
Document configuration changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BuJo committed Jan 29, 2024
1 parent 0df62b4 commit 1019ad1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Releases

## 1.5.0 - XXX backend mode

* Add `alertmanager` API, e.g. `/api/alertmanager/v2/status`
* Add negative matchers: `!=` and `!~`
* Breaking configuration changes:
* To be more compatible with `alertmanager`, the `~=` is now `=~`
using regular expression matching.

## v1.4 - 2024-01-11 light mode

* Make the look of tuwat configurable via `style` property.
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/rule_matching.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func ParseRuleMatcher(value string) RuleMatcher {
prefix := matches[1]
value := matches[2]
switch prefix {
case "=~":
case "=~", "~=":
return regexpMatcher{regexp.MustCompile(value)}
case "!~":
return not(regexpMatcher{regexp.MustCompile(value)})
Expand Down
6 changes: 3 additions & 3 deletions pkg/config/rule_matching_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestParseRuleMatcher(t *testing.T) {
want: regexpMatcher{regexp.MustCompile("X")},
}, {
name: "Regexp",
value: "~= X",
value: "=~ X",
want: regexpMatcher{regexp.MustCompile("X")},
}, {
name: "numeric equality matcher",
Expand Down Expand Up @@ -84,7 +84,7 @@ func TestRuleMatching(t *testing.T) {
want: true,
}, {
name: "regexp",
rule: "~= X",
rule: "=~ X",
str: "Xavier",
want: true,
}, {
Expand Down Expand Up @@ -137,7 +137,7 @@ func TestRuleMatching(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := ParseRuleMatcher(tt.rule); got.MatchString(tt.str) != tt.want {
t.Errorf("Matching %v ~= %v, want %v", tt.rule, tt.str, tt.want)
t.Errorf("Matching %v =~ %v, want %v", tt.rule, tt.str, tt.want)
}
})
}
Expand Down

0 comments on commit 1019ad1

Please sign in to comment.