Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit98c35a9

Browse files
committed
fix: fix listening flake on TestTailnet_ForcesWebSockets
1 parentaa0dc2d commit98c35a9

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

‎tailnet/conn_test.go‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,23 +131,28 @@ func TestTailnet(t *testing.T) {
131131
stitch(t,w2,w1)
132132
stitch(t,w1,w2)
133133
require.True(t,w2.AwaitReachable(ctx,w1IP))
134-
conn:=make(chanstruct{},1)
134+
done:=make(chanstruct{})
135+
listening:=make(chanstruct{})
135136
gofunc() {
137+
deferclose(done)
136138
listener,err:=w1.Listen("tcp",":35565")
137-
assert.NoError(t,err)
139+
if!assert.NoError(t,err) {
140+
return
141+
}
138142
deferlistener.Close()
143+
close(listening)
139144
nc,err:=listener.Accept()
140145
if!assert.NoError(t,err) {
141146
return
142147
}
143148
_=nc.Close()
144-
conn<-struct{}{}
145149
}()
146150

151+
testutil.RequireRecvCtx(ctx,t,listening)
147152
nc,err:=w2.DialContextTCP(ctx,netip.AddrPortFrom(w1IP,35565))
148153
require.NoError(t,err)
149154
_=nc.Close()
150-
<-conn
155+
testutil.RequireRecvCtx(ctx,t,done)
151156

152157
nodes:=make(chan*tailnet.Node,1)
153158
w2.SetNodeCallback(func(node*tailnet.Node) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp