Move alerting provider mocked tests at the watchdog level

This commit is contained in:
TwiN
2021-12-02 22:15:51 -05:00
parent f6336eac4e
commit 6954e9dde7
23 changed files with 279 additions and 176 deletions

View File

@ -1,10 +1,8 @@
package email
import (
"errors"
"fmt"
"math"
"os"
"strings"
"github.com/TwiN/gatus/v3/alerting/alert"
@ -31,12 +29,6 @@ func (provider *AlertProvider) IsValid() bool {
// Send an alert using the provider
func (provider *AlertProvider) Send(endpoint *core.Endpoint, alert *alert.Alert, result *core.Result, resolved bool) error {
if os.Getenv("MOCK_ALERT_PROVIDER") == "true" {
if os.Getenv("MOCK_ALERT_PROVIDER_ERROR") == "true" {
return errors.New("error")
}
return nil
}
subject, body := provider.buildMessageSubjectAndBody(endpoint, alert, result, resolved)
m := gomail.NewMessage()
m.SetHeader("From", provider.From)