refactor(alerting): Use pointer for receiver in AlertProvider.GetDefaultAlert method (#676)

This commit is contained in:
TwiN
2024-02-07 20:09:45 -05:00
committed by GitHub
parent 2a623a59d3
commit 08742e4af3
35 changed files with 53 additions and 52 deletions

View File

@ -2,6 +2,8 @@ package awsses
import (
"fmt"
"strings"
"github.com/TwiN/gatus/v5/alerting/alert"
"github.com/TwiN/gatus/v5/core"
"github.com/aws/aws-sdk-go/aws"
@ -9,7 +11,6 @@ import (
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ses"
"strings"
)
const (
@ -148,7 +149,7 @@ func (provider *AlertProvider) getToForGroup(group string) string {
}
// GetDefaultAlert returns the provider's default alert configuration
func (provider AlertProvider) GetDefaultAlert() *alert.Alert {
func (provider *AlertProvider) GetDefaultAlert() *alert.Alert {
return provider.DefaultAlert
}

View File

@ -116,10 +116,10 @@ func TestAlertProvider_buildRequestBody(t *testing.T) {
}
func TestAlertProvider_GetDefaultAlert(t *testing.T) {
if (AlertProvider{DefaultAlert: &alert.Alert{}}).GetDefaultAlert() == nil {
if (&AlertProvider{DefaultAlert: &alert.Alert{}}).GetDefaultAlert() == nil {
t.Error("expected default alert to be not nil")
}
if (AlertProvider{DefaultAlert: nil}).GetDefaultAlert() != nil {
if (&AlertProvider{DefaultAlert: nil}).GetDefaultAlert() != nil {
t.Error("expected default alert to be nil")
}
}