-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(pager_duty): fix linter complaints
- Loading branch information
Showing
4 changed files
with
16 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package pagerduty_test | ||
|
||
import ( | ||
"fmt" | ||
"errors" | ||
"testing" | ||
|
||
gopagerduty "github.com/PagerDuty/go-pagerduty" | ||
|
@@ -56,30 +56,30 @@ func TestConfig_OK(t *testing.T) { | |
config: &pagerduty.Config{ | ||
Receivers: []string{"AB1234", "CD5678"}, | ||
}, | ||
wantErr: fmt.Errorf("from address is required"), | ||
wantErr: errors.New("from address is required"), | ||
}, | ||
{ | ||
name: "invalid_from_address", | ||
config: &pagerduty.Config{ | ||
FromAddress: "senderdomain.com", | ||
Receivers: []string{"AB1234", "CD5678"}, | ||
}, | ||
wantErr: fmt.Errorf("from address is invalid: mail: missing '@' or angle-addr"), | ||
wantErr: errors.New("from address is invalid: mail: missing '@' or angle-addr"), | ||
}, | ||
{ | ||
name: "missing_receivers", | ||
config: &pagerduty.Config{ | ||
FromAddress: "[email protected]", | ||
}, | ||
wantErr: fmt.Errorf("at least one receiver is required"), | ||
wantErr: errors.New("at least one receiver is required"), | ||
}, | ||
{ | ||
name: "missing_notification_type", | ||
config: &pagerduty.Config{ | ||
FromAddress: "[email protected]", | ||
Receivers: []string{"AB1234", "CD5678"}, | ||
}, | ||
wantErr: fmt.Errorf("notification type is required"), | ||
wantErr: errors.New("notification type is required"), | ||
}, | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ package pagerduty_test | |
|
||
import ( | ||
"context" | ||
"fmt" | ||
"errors" | ||
"testing" | ||
|
||
gopagerduty "github.com/PagerDuty/go-pagerduty" | ||
|
@@ -29,7 +29,7 @@ func (m *mockClient) CreateIncidentWithContext( | |
|
||
incident, isIncident := args.Get(0).(*gopagerduty.Incident) | ||
if !isIncident { | ||
return nil, fmt.Errorf("unexpected type for first argument") | ||
return nil, errors.New("unexpected type for first argument") | ||
} | ||
|
||
return incident, nil | ||
|
@@ -89,7 +89,7 @@ func TestPagerDuty_Send(t *testing.T) { | |
message: "Test Message", | ||
mockSetup: func(m *mockClient) { | ||
m.On("CreateIncidentWithContext", mock.Anything, "[email protected]", mock.Anything). | ||
Return(nil, fmt.Errorf("invalid configuration: at least one receiver is required")) | ||
Return(nil, errors.New("invalid configuration: at least one receiver is required")) | ||
}, | ||
expectedError: "invalid configuration: at least one receiver is required", | ||
}, | ||
|