Skip to content

Commit dda9c56

Browse files
authored
fix: fix TestTailnet/Connect to wait for listener before dialing (#14148)
1 parent e035112 commit dda9c56

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tailnet/conn_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,13 @@ func TestTailnet(t *testing.T) {
6464
stitch(t, w1, w2)
6565
require.True(t, w2.AwaitReachable(context.Background(), w1IP))
6666
conn := make(chan struct{}, 1)
67+
listenDone := make(chan struct{})
6768
go func() {
6869
listener, err := w1.Listen("tcp", ":35565")
69-
assert.NoError(t, err)
70+
if !assert.NoError(t, err) {
71+
return
72+
}
73+
close(listenDone)
7074
defer listener.Close()
7175
nc, err := listener.Accept()
7276
if !assert.NoError(t, err) {
@@ -76,6 +80,7 @@ func TestTailnet(t *testing.T) {
7680
conn <- struct{}{}
7781
}()
7882

83+
_ = testutil.RequireRecvCtx(ctx, t, listenDone)
7984
nc, err := w2.DialContextTCP(context.Background(), netip.AddrPortFrom(w1IP, 35565))
8085
require.NoError(t, err)
8186
_ = nc.Close()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy