Skip to content

fix: fix listening flake on TestTailnet_ForcesWebSockets #15555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions tailnet/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,23 +131,28 @@ func TestTailnet(t *testing.T) {
stitch(t, w2, w1)
stitch(t, w1, w2)
require.True(t, w2.AwaitReachable(ctx, w1IP))
conn := make(chan struct{}, 1)
done := make(chan struct{})
listening := make(chan struct{})
go func() {
defer close(done)
listener, err := w1.Listen("tcp", ":35565")
assert.NoError(t, err)
if !assert.NoError(t, err) {
return
}
defer listener.Close()
close(listening)
nc, err := listener.Accept()
if !assert.NoError(t, err) {
return
}
_ = nc.Close()
conn <- struct{}{}
}()

testutil.RequireRecvCtx(ctx, t, listening)
nc, err := w2.DialContextTCP(ctx, netip.AddrPortFrom(w1IP, 35565))
require.NoError(t, err)
_ = nc.Close()
<-conn
testutil.RequireRecvCtx(ctx, t, done)

nodes := make(chan *tailnet.Node, 1)
w2.SetNodeCallback(func(node *tailnet.Node) {
Expand Down
Loading