git » chasquid » commit e8a6bf6

smtpsrv: Make tests log maillog to stdout

author Alberto Bertogli
2019-12-01 18:21:13 UTC
committer Alberto Bertogli
2019-12-01 19:09:57 UTC
parent a6a964ac3e2ca9807d8caba4ec9ae1498f843245

smtpsrv: Make tests log maillog to stdout

internal/smtpsrv/server_test.go +5 -0

diff --git a/internal/smtpsrv/server_test.go b/internal/smtpsrv/server_test.go
index 15364fd..6da06a8 100644
--- a/internal/smtpsrv/server_test.go
+++ b/internal/smtpsrv/server_test.go
@@ -18,6 +18,7 @@ import (
 	"time"
 
 	"blitiri.com.ar/go/chasquid/internal/aliases"
+	"blitiri.com.ar/go/chasquid/internal/maillog"
 	"blitiri.com.ar/go/chasquid/internal/testlib"
 	"blitiri.com.ar/go/chasquid/internal/userdb"
 )
@@ -532,6 +533,10 @@ func realMain(m *testing.M) int {
 	}
 	str1MiB = string(buf)
 
+	// Set up the mail log to stdout, which is captured by the test runner,
+	// so we have better debugging information on failures.
+	maillog.Default = maillog.New(os.Stdout)
+
 	if *externalSMTPAddr != "" {
 		smtpAddr = *externalSMTPAddr
 		submissionAddr = *externalSubmissionAddr