Skip to content

Commit 2573049

Browse files
committed
Add timeout
1 parent df575a0 commit 2573049

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tailnet/conn_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"path/filepath"
99
"strings"
1010
"testing"
11+
"time"
1112

1213
"github.com/stretchr/testify/assert"
1314
"github.com/stretchr/testify/require"
@@ -286,6 +287,8 @@ func TestTransmitHang(t *testing.T) {
286287
w, err := send.DialContextTCP(ctx, netip.AddrPortFrom(recvIP, 35565))
287288
require.NoError(t, err)
288289

290+
now := time.Now()
291+
289292
payload := []byte(strings.Repeat("hello world\n", 65536/12))
290293
size := 0
291294
for i := 0; i < 1024*2; i++ {
@@ -299,4 +302,8 @@ func TestTransmitHang(t *testing.T) {
299302
require.NoError(t, err)
300303

301304
<-copyDone
305+
306+
if time.Since(now) > 10*time.Second {
307+
t.Fatal("took too long to transmit")
308+
}
302309
}

0 commit comments

Comments
 (0)