Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
fix: fix parsing subscriptions settings
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmt committed Mar 20, 2020
1 parent 4123bd0 commit 5958e6c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions shared/settings/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,8 @@ func (cfg *Config) Merge(other *Config) *Config {
res.Templates = append(res.Templates, templatesMap[k])
}
res.Context = contextValues
if other.Subscriptions != nil {
res.Subscriptions = other.Subscriptions
}
return res
}
21 changes: 21 additions & 0 deletions shared/settings/settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,27 @@ func TestMergeConfigTriggers(t *testing.T) {
}})
}

func TestMergeSubscriptions(t *testing.T) {
cfg := Config{
Subscriptions: []Subscription{{
Recipients: []string{"foo"},
Triggers: []string{"far"},
}},
}

merged := cfg.Merge(&Config{
Subscriptions: []Subscription{{
Recipients: []string{"replacedFoo"},
Triggers: []string{"replacedFoo"},
}},
})

assert.ElementsMatch(t, merged.Subscriptions, []Subscription{{
Recipients: []string{"replacedFoo"},
Triggers: []string{"replacedFoo"},
}})
}

func TestDefaultSubscriptions_GetRecipients(t *testing.T) {
selector, err := labels.Parse("test=true")
assert.NoError(t, err)
Expand Down

0 comments on commit 5958e6c

Please sign in to comment.