test(agent): Fix TestAgent_UnixRemoteForwarding timeout (#7235)

This commit is contained in:
Mathias Fredriksson
2023-04-21 01:35:51 +03:00
committed by GitHub
parent 38a6d546ab
commit 300ae4a6bf
+4 -1
View File
@@ -733,12 +733,15 @@ func TestAgent_UnixRemoteForwarding(t *testing.T) {
// It's possible that the socket is created but the server is not ready to
// accept connections yet. We need to retry until we can connect.
//
// Note that we wait long here because if the tailnet connection has trouble
// connecting, it could take 5 seconds or more to reconnect.
var conn net.Conn
require.Eventually(t, func() bool {
var err error
conn, err = net.Dial("unix", remoteSocketPath)
return err == nil
}, testutil.WaitShort, testutil.IntervalFast)
}, testutil.WaitLong, testutil.IntervalFast)
defer conn.Close()
_, err = conn.Write([]byte("test"))
require.NoError(t, err)