From a45ec2670df0c3a92f2d6b5657f24df87a66369c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Calisto?= Date: Fri, 6 Sep 2024 13:17:26 +0100 Subject: [PATCH] chore(tests): fix flaky SMTP test (#93031) --- pkg/services/notifications/smtp_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/services/notifications/smtp_test.go b/pkg/services/notifications/smtp_test.go index e55bcd50639..78e9d76e454 100644 --- a/pkg/services/notifications/smtp_test.go +++ b/pkg/services/notifications/smtp_test.go @@ -8,6 +8,7 @@ import ( "fmt" "io" "net/textproto" + "sort" "strings" "testing" "time" @@ -301,6 +302,11 @@ func TestSmtpSend(t *testing.T) { messages := srv.MessagesAndPurge() assert.Len(t, messages, 3) + // sort for test consistency + sort.Slice(messages, func(i, j int) bool { + return messages[i].RcpttoRequestResponse()[0][0] < messages[j].RcpttoRequestResponse()[0][0] + }) + for i, sentMsg := range messages { rcpts := sentMsg.RcpttoRequestResponse() assert.EqualValues(t, [][]string{