Skip to content

Commit

Permalink
fix: enable skipped tests for notification rules and fixup issue in t…
Browse files Browse the repository at this point in the history
…ag matcher
  • Loading branch information
jsteenb2 committed Jan 2, 2020
1 parent acf73df commit 77dd06b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
1. [16268](https://github.com/influxdata/influxdb/pull/16268): Fixed test flakiness that stemmed from multiple flush/signins being called in the same test suite
1. [16346](https://github.com/influxdata/influxdb/pull/16346): Update pkger task export to only trim out option task and not all vars provided
1. [16374](https://github.com/influxdata/influxdb/pull/16374): Update influx CLI, only show "see help" message, instead of the whole usage.
1. [16380](https://github.com/influxdata/influxdb/pull/16380): Fix notification tag matching rules and enable tests to verify

### UI Improvements

Expand Down
4 changes: 1 addition & 3 deletions kv/notification_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,7 @@ func (s *Service) forEachNotificationRule(ctx context.Context, tx Tx, descending
return nil
}

func filterNotificationRulesFn(
idMap map[influxdb.ID]bool,
filter influxdb.NotificationRuleFilter) func(nr influxdb.NotificationRule) bool {
func filterNotificationRulesFn(idMap map[influxdb.ID]bool, filter influxdb.NotificationRuleFilter) func(nr influxdb.NotificationRule) bool {
if filter.OrgID != nil {
return func(nr influxdb.NotificationRule) bool {
if !nr.MatchesTags(filter.Tags) {
Expand Down
1 change: 0 additions & 1 deletion kv/notification_rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
)

func TestBoltNotificationRuleStore(t *testing.T) {
t.Skip("https://github.com/influxdata/influxdb/issues/14799")
influxdbtesting.NotificationRuleStore(initBoltNotificationRuleStore, t)
}

Expand Down
4 changes: 3 additions & 1 deletion notification/rule/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,9 @@ func (b *Base) ClearPrivateData() {

// MatchesTags returns true if the Rule matches all of the tags
func (b *Base) MatchesTags(tags []influxdb.Tag) bool {

if len(tags) == 0 {
return true
}
// for each tag in NR
// if there exists
// a key value match with operator == equal in tags
Expand Down
14 changes: 14 additions & 0 deletions notification/rule/rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,20 @@ func TestMatchingRules(t *testing.T) {
},
exp: true,
},
{
name: "Non empty tag rule matches empty filter tags",
tagRules: []notification.TagRule{
{
Tag: influxdb.Tag{
Key: "c",
Value: "d",
},
Operator: influxdb.NotEqual,
},
},
filterTags: []influxdb.Tag{},
exp: true,
},
{
name: "Empty tag rule matches empty filter tags",
tagRules: []notification.TagRule{},
Expand Down

0 comments on commit 77dd06b

Please sign in to comment.