MCPcopy Index your code
hub / github.com/foxcpp/maddy / FailOnConn

Function FailOnConn

internal/testutils/smtp_server.go:415–431  ·  view source on GitHub ↗

FailOnConn fails the test if attempt is made to connect the specified endpoint.

(t *testing.T, addr string)

Source from the content-addressed store, hash-verified

413// FailOnConn fails the test if attempt is made to connect the
414// specified endpoint.
415func FailOnConn(t *testing.T, addr string) net.Listener {
416 t.Helper()
417
418 tarpit, err := net.Listen("tcp", addr)
419 if err != nil {
420 t.Fatal(err)
421 }
422 go func() {
423 t.Helper()
424
425 _, err := tarpit.Accept()
426 if err == nil {
427 t.Error("No connection expected")
428 }
429 }()
430 return tarpit
431}
432
433func CheckSMTPErr(t *testing.T, err error, code int, enchCode exterrors.EnhancedCode, msg string) {
434 t.Helper()

Callers

nothing calls this directly

Calls 2

ListenMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected