feat(GODT-2538): implement smart picking of default IMAP/SMTP ports

This commit is contained in:
Xavier Michelon
2023-04-06 15:08:41 +02:00
parent 54b209f9e1
commit 3ddd88e127
9 changed files with 182 additions and 12 deletions

View File

@ -20,6 +20,7 @@ package tests
import (
"context"
"fmt"
"net"
"net/smtp"
"net/url"
"regexp"
@ -160,6 +161,9 @@ type testCtx struct {
// errors holds test-related errors encountered while running test steps.
errors [][]error
errorsLock sync.RWMutex
// This slice contains the dummy listeners that are intended to block network ports.
dummyListeners []net.Listener
}
type imapClient struct {
@ -437,6 +441,12 @@ func (t *testCtx) close(ctx context.Context) {
}
}
for _, listener := range t.dummyListeners {
if err := listener.Close(); err != nil {
logrus.WithError(err).Errorf("Failed to close dummy listener %v", listener.Addr())
}
}
t.api.Close()
t.events.close()
t.reporter.close()