diff --git a/notification/endpoint/endpoint_test.go b/notification/endpoint/endpoint_test.go index c3be26142b1..ce08c681122 100644 --- a/notification/endpoint/endpoint_test.go +++ b/notification/endpoint/endpoint_test.go @@ -189,7 +189,7 @@ func TestValidEndpoint(t *testing.T) { }, err: &influxdb.Error{ Code: influxdb.EInvalid, - Msg: "empty teams URL", + Msg: "teams: empty URL", }, }, { @@ -325,7 +325,7 @@ func TestJSON(t *testing.T) { }, { name: "teams without secretURLSuffix", - src: &endpoint.Slack{ + src: &endpoint.Teams{ Base: endpoint.Base{ ID: influxTesting.MustIDBase16Ptr(id1), Name: "name1", diff --git a/notification/endpoint/teams.go b/notification/endpoint/teams.go index 13f6d092a90..8e428d613be 100644 --- a/notification/endpoint/teams.go +++ b/notification/endpoint/teams.go @@ -46,15 +46,16 @@ func (s Teams) Valid() error { if s.URL == "" { return &influxdb.Error{ Code: influxdb.EInvalid, - Msg: "empty teams URL", + Msg: "teams: empty URL", } } return nil } +type teamsAlias Teams + // MarshalJSON implement json.Marshaler interface. func (s Teams) MarshalJSON() ([]byte, error) { - type teamsAlias Teams return json.Marshal( struct { teamsAlias diff --git a/notification/rule/teams.go b/notification/rule/teams.go index 7e956cc0a57..71be3d8b19c 100644 --- a/notification/rule/teams.go +++ b/notification/rule/teams.go @@ -109,13 +109,13 @@ func (s Teams) Valid() error { if s.Title == "" { return &influxdb.Error{ Code: influxdb.EInvalid, - Msg: "Teams Title is empty", + Msg: "teams: empty title", } } if s.MessageTemplate == "" { return &influxdb.Error{ Code: influxdb.EInvalid, - Msg: "Teams MessageTemplate is empty", + Msg: "teams: empty messageTemplate", } } return nil @@ -123,5 +123,5 @@ func (s Teams) Valid() error { // Type returns the type of the rule config. func (s Teams) Type() string { - return "teams" + return endpoint.TeamsType } diff --git a/notification/rule/teams_test.go b/notification/rule/teams_test.go index c4cb6c2c24e..6d6390b4104 100644 --- a/notification/rule/teams_test.go +++ b/notification/rule/teams_test.go @@ -272,7 +272,7 @@ func TestTeams_Valid(t *testing.T) { }, err: &influxdb.Error{ Code: influxdb.EInvalid, - Msg: "Teams MessageTemplate is empty", + Msg: "teams: empty messageTemplate", }, }, { @@ -297,7 +297,7 @@ func TestTeams_Valid(t *testing.T) { }, err: &influxdb.Error{ Code: influxdb.EInvalid, - Msg: "Teams Title is empty", + Msg: "teams: empty title", }, }, {