Skip to content

Commit 8385c0a

Browse files
committed
Fix TestDataExchangeLargePayload race on slow CI runners
srv.ListenAndServe spins up the bind in a goroutine; macOS-latest CI is slow enough that Dial fired before the listener accepted and saw `dial: daemon: connection refused`. Retry Dial briefly so the server goroutine has a chance to bind.
1 parent 3868242 commit 8385c0a

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

tests/dataexchange_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,18 @@ func TestDataExchangeLargePayload(t *testing.T) {
147147
srv := dataexchange.NewServer(a.Driver, handler)
148148
go srv.ListenAndServe()
149149

150-
c, err := dataexchange.Dial(b.Driver, a.Daemon.Addr())
150+
// srv.ListenAndServe spins up the bind async; on slower CI runners
151+
// (macOS-latest) Dial can fire before the listener is accepting.
152+
// Retry briefly.
153+
var c *dataexchange.Client
154+
var err error
155+
for i := 0; i < 20; i++ {
156+
c, err = dataexchange.Dial(b.Driver, a.Daemon.Addr())
157+
if err == nil {
158+
break
159+
}
160+
time.Sleep(50 * time.Millisecond)
161+
}
151162
if err != nil {
152163
t.Fatalf("dial: %v", err)
153164
}

0 commit comments

Comments
 (0)