feat(server): test teams tickscript alert
parent
2acc3c7551
commit
58d98264bd
|
@ -9,6 +9,7 @@ import (
|
||||||
func TestAlertServices(t *testing.T) {
|
func TestAlertServices(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
|
skip string
|
||||||
rule chronograf.AlertRule
|
rule chronograf.AlertRule
|
||||||
want chronograf.TICKScript
|
want chronograf.TICKScript
|
||||||
wantErr bool
|
wantErr bool
|
||||||
|
@ -181,11 +182,33 @@ func TestAlertServices(t *testing.T) {
|
||||||
.appKey('a')
|
.appKey('a')
|
||||||
.primaryProperty('b')
|
.primaryProperty('b')
|
||||||
.secondaryProperty('c')
|
.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 {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
if tt.skip != "" {
|
||||||
|
t.Skip(tt.skip)
|
||||||
|
}
|
||||||
got, err := AlertServices(tt.rule)
|
got, err := AlertServices(tt.rule)
|
||||||
if (err != nil) != tt.wantErr {
|
if (err != nil) != tt.wantErr {
|
||||||
t.Errorf("%q. AlertServices() error = %v, wantErr %v", tt.name, err, tt.wantErr)
|
t.Errorf("%q. AlertServices() error = %v, wantErr %v", tt.name, err, tt.wantErr)
|
||||||
|
|
Loading…
Reference in New Issue