mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-08 23:12:54 +01:00
MacOS tests on GH seem to have issued with the sendmail as well. Let's try timeouts
This commit is contained in:
parent
24b99cf0af
commit
8f9fc61c1e
1 changed files with 10 additions and 4 deletions
|
@ -3,10 +3,14 @@
|
|||
|
||||
package mail
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
// TestMsg_WriteToSendmailWithCommand tests the WriteToSendmailWithCommand() method of the Msg
|
||||
func TestMsg_WriteToSendmailWithCommand(t *testing.T) {
|
||||
// TestMsg_WriteToSendmailWithContext tests the WriteToSendmailWithContext() method of the Msg
|
||||
func TestMsg_WriteToSendmailWithContext(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
sp string
|
||||
|
@ -20,8 +24,10 @@ func TestMsg_WriteToSendmailWithCommand(t *testing.T) {
|
|||
m := NewMsg()
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
ctx, cfn := context.WithTimeout(context.Background(), time.Second*10)
|
||||
defer cfn()
|
||||
m.SetBodyString(TypeTextPlain, "Plain")
|
||||
if err := m.WriteToSendmailWithCommand(tt.sp); err != nil && !tt.sf {
|
||||
if err := m.WriteToSendmailWithContext(ctx, tt.sp); err != nil && !tt.sf {
|
||||
t.Errorf("WriteToSendmailWithCommand() failed: %s", err)
|
||||
}
|
||||
m.Reset()
|
||||
|
|
Loading…
Reference in a new issue