(t *testing.T)
| 661 | } |
| 662 | |
| 663 | func TestWaitForTCPPortSuccess(t *testing.T) { |
| 664 | // Start a simple TCP listener |
| 665 | listener, err := net.Listen("tcp", "127.0.0.1:0") |
| 666 | require.NoError(t, err) |
| 667 | defer listener.Close() |
| 668 | |
| 669 | addr := listener.Addr().(*net.TCPAddr) |
| 670 | port := addr.Port |
| 671 | |
| 672 | ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) |
| 673 | defer cancel() |
| 674 | |
| 675 | err = WaitForTCPPort(ctx, "127.0.0.1", port, 5*time.Second) |
| 676 | require.NoError(t, err) |
| 677 | } |
| 678 | |
| 679 | func TestWaitForTCPPortTimeout(t *testing.T) { |
| 680 | // Use a port that's definitely not listening |
nothing calls this directly
no test coverage detected