chore(tests): fix flaky SMTP test (#93031)

This commit is contained in:
João Calisto 2024-09-06 13:17:26 +01:00 committed by GitHub
parent 8ea374b773
commit a45ec2670d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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{