feat(server): test teams tickscript alert

pull/5740/head
Pavel Zavora 2021-04-27 06:02:30 +02:00
parent 2acc3c7551
commit 58d98264bd
1 changed files with 23 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import (
func TestAlertServices(t *testing.T) {
tests := []struct {
name string
skip string
rule chronograf.AlertRule
want chronograf.TICKScript
wantErr bool
@ -181,11 +182,33 @@ func TestAlertServices(t *testing.T) {
.appKey('a')
.primaryProperty('b')
.secondaryProperty('c')
`,
},
{
name: "Test Teams",
skip: "Parsing is not implemented yet in the kapactior pipeline!",
rule: chronograf.AlertRule{
AlertNodes: chronograf.AlertNodes{
Teams: []*chronograf.Teams{{
Team: "teams.microsoft.com/team/",
Channel: "#channel",
ChannelURL: "https://outlook.office.com/webhook/...",
}},
},
},
want: `alert()
.teams()
.channelURL('https://outlook.office.com/webhook/...')
.team('teams.microsoft.com/team/')
.channel('#channel')
`,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if tt.skip != "" {
t.Skip(tt.skip)
}
got, err := AlertServices(tt.rule)
if (err != nil) != tt.wantErr {
t.Errorf("%q. AlertServices() error = %v, wantErr %v", tt.name, err, tt.wantErr)