mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
notifications: Fix flaky SMTP tests (#90801)
Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
This commit is contained in:
parent
a1182b119e
commit
a59c9525c1
@ -10,6 +10,7 @@ import (
|
||||
"net/textproto"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
smtpmock "github.com/mocktools/go-smtp-mock/v2"
|
||||
"github.com/stretchr/testify/assert"
|
||||
@ -150,10 +151,9 @@ func TestSmtpDialer(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSmtpSend(t *testing.T) {
|
||||
// Test is currently very flaky. Skipping it for now.
|
||||
t.Skip()
|
||||
srv := smtpmock.New(smtpmock.ConfigurationAttr{
|
||||
MultipleRcptto: true,
|
||||
HostAddress: "127.0.0.1",
|
||||
})
|
||||
require.NoError(t, srv.Start())
|
||||
defer func() { _ = srv.Stop() }()
|
||||
@ -183,6 +183,8 @@ func TestSmtpSend(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, count)
|
||||
|
||||
// workaround for https://github.com/mocktools/go-smtp-mock/issues/181
|
||||
time.Sleep(1 * time.Millisecond)
|
||||
messages := srv.MessagesAndPurge()
|
||||
require.Len(t, messages, 1)
|
||||
sentMsg := messages[0]
|
||||
@ -233,6 +235,8 @@ func TestSmtpSend(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, count)
|
||||
|
||||
// workaround for https://github.com/mocktools/go-smtp-mock/issues/181
|
||||
time.Sleep(1 * time.Millisecond)
|
||||
messages := srv.MessagesAndPurge()
|
||||
require.Len(t, messages, 1)
|
||||
sentMsg := messages[0]
|
||||
@ -292,6 +296,8 @@ func TestSmtpSend(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 3, count)
|
||||
|
||||
// workaround for https://github.com/mocktools/go-smtp-mock/issues/181
|
||||
time.Sleep(1 * time.Millisecond)
|
||||
messages := srv.MessagesAndPurge()
|
||||
require.Len(t, messages, 3)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user