@@ -1111,9 +1111,11 @@ func TestNotificationTemplates_Golden(t *testing.T) {
1111
1111
var msg * mocksmtp.Message
1112
1112
require .Eventually (t , func () bool {
1113
1113
msg = backend .LastMessage ()
1114
- return msg != nil
1114
+ return msg != nil && len ( msg . Contents ) > 0
1115
1115
}, testutil .WaitShort , testutil .IntervalFast )
1116
- require .NotNil (t , msg , "want a message to be sent" )
1116
+
1117
+ // require.NotNil(t, msg, "want a message to be sent")
1118
+ // require.NotEmpty(t, msg.Contents, "want a non-empty message")
1117
1119
1118
1120
body := normalizeGoldenEmail ([]byte (msg .Contents ))
1119
1121
@@ -1225,7 +1227,12 @@ func normalizeGoldenEmail(content []byte) []byte {
1225
1227
dateRegex := regexp .MustCompile (`Date: .+` )
1226
1228
messageIDRegex := regexp .MustCompile (`Message-Id: .+` )
1227
1229
boundaryRegex := regexp .MustCompile (`boundary=([0-9a-zA-Z]+)` )
1228
- boundary := boundaryRegex .FindSubmatch (content )[1 ]
1230
+ submatches := boundaryRegex .FindSubmatch (content )
1231
+ if len (submatches ) == 0 {
1232
+ return content
1233
+ }
1234
+
1235
+ boundary := submatches [1 ]
1229
1236
1230
1237
content = dateRegex .ReplaceAll (content , []byte ("Date: " + constantDate ))
1231
1238
content = messageIDRegex .ReplaceAll (content , []byte ("Message-Id: " + constantMessageID ))
0 commit comments