MCPcopy Create free account
hub / github.com/Thunder-Compute/thunder-cli / TestWaitForTCPPortSuccess

Function TestWaitForTCPPortSuccess

utils/ssh_test.go:663–677  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

661}
662
663func 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
679func TestWaitForTCPPortTimeout(t *testing.T) {
680 // Use a port that's definitely not listening

Callers

nothing calls this directly

Calls 2

WaitForTCPPortFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected