Skip to content

Commit 9308532

Browse files
committed
chore: increase wait time to ensure TCP connections (#1293)
Fixes #1291
1 parent b011ed5 commit 9308532

1 file changed

Lines changed: 2 additions & 17 deletions

File tree

internal/proxy/proxy_test.go

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -354,32 +354,17 @@ func TestClientCloseWaitsForActiveConnections(t *testing.T) {
354354
Instances: []proxy.InstanceConnConfig{
355355
{Name: "proj:region:pg"},
356356
},
357+
WaitOnClose: 5 * time.Second,
357358
}
358-
359359
c, err := proxy.NewClient(context.Background(), &fakeDialer{}, logger, in)
360360
if err != nil {
361361
t.Fatalf("proxy.NewClient error: %v", err)
362362
}
363363
go c.Serve(context.Background(), func() {})
364364

365-
conn := tryTCPDial(t, "127.0.0.1:5000")
366-
_ = conn.Close()
367-
368-
if err := c.Close(); err != nil {
369-
t.Fatalf("c.Close error: %v", err)
370-
}
371-
372-
in.WaitOnClose = time.Second
373-
in.Port = 5001
374-
c, err = proxy.NewClient(context.Background(), &fakeDialer{}, logger, in)
375-
if err != nil {
376-
t.Fatalf("proxy.NewClient error: %v", err)
377-
}
378-
go c.Serve(context.Background(), func() {})
379-
380365
var open []net.Conn
381366
for i := 0; i < 5; i++ {
382-
conn = tryTCPDial(t, "127.0.0.1:5001")
367+
conn := tryTCPDial(t, "127.0.0.1:5000")
383368
open = append(open, conn)
384369
}
385370
defer func() {

0 commit comments

Comments
 (0)