FailOnConn fails the test if attempt is made to connect the specified endpoint.
(t *testing.T, addr string)
| 413 | // FailOnConn fails the test if attempt is made to connect the |
| 414 | // specified endpoint. |
| 415 | func 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 | |
| 433 | func CheckSMTPErr(t *testing.T, err error, code int, enchCode exterrors.EnhancedCode, msg string) { |
| 434 | t.Helper() |