Skip to content

Commit

Permalink
chore: apply review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sranka committed Aug 14, 2020
1 parent 82ca912 commit 567728f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions notification/endpoint/endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func TestValidEndpoint(t *testing.T) {
},
err: &influxdb.Error{
Code: influxdb.EInvalid,
Msg: "empty teams URL",
Msg: "teams: empty URL",
},
},
{
Expand Down Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions notification/endpoint/teams.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions notification/rule/teams.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,19 @@ 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
}

// Type returns the type of the rule config.
func (s Teams) Type() string {
return "teams"
return endpoint.TeamsType
}
4 changes: 2 additions & 2 deletions notification/rule/teams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
{
Expand All @@ -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",
},
},
{
Expand Down

0 comments on commit 567728f

Please sign in to comment.