GODT-1159 SMTP server not restarting after restored internet

- [x] write tests to check that IMAP and SMTP servers are closed when there
  is no internet
- [x] always create new go-smtp instance during listenAndServe(int)
This commit is contained in:
Jakub
2021-05-04 13:50:26 +02:00
committed by James Houlahan
parent 0b95ed4dea
commit dd66b7f8d0
19 changed files with 519 additions and 227 deletions

View File

@ -24,6 +24,8 @@ import (
func SMTPChecksFeatureContext(s *godog.Suite) {
s.Step(`^SMTP response is "([^"]*)"$`, smtpResponseIs)
s.Step(`^SMTP response to "([^"]*)" is "([^"]*)"$`, smtpResponseNamedIs)
s.Step(`^SMTP client is logged out`, smtpClientIsLoggedOut)
s.Step(`^SMTP client "([^"]*)" is logged out`, smtpClientNamedIsLoggedOut)
}
func smtpResponseIs(expectedResponse string) error {
@ -39,3 +41,13 @@ func smtpResponseNamedIs(clientID, expectedResponse string) error {
}
return ctx.GetTestingError()
}
func smtpClientIsLoggedOut() error {
return smtpClientNamedIsLoggedOut("smtp")
}
func smtpClientNamedIsLoggedOut(clientName string) error {
res := ctx.GetSMTPClient(clientName).SendCommands("HELO loggedOut.com")
res.AssertError("read response failed:")
return ctx.GetTestingError()
}