Skip to content

Commit 2ab226c

Browse files
authored
chore: increase wait time to ensure TCP connections (GoogleCloudPlatform#127)
This is port of GoogleCloudPlatform/cloud-sql-proxy#1293.
1 parent 1d03b71 commit 2ab226c

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

internal/proxy/proxy_test.go

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -337,32 +337,17 @@ func TestClientCloseWaitsForActiveConnections(t *testing.T) {
337337
Instances: []proxy.InstanceConnConfig{
338338
{Name: "proj:region:pg"},
339339
},
340+
WaitOnClose: 5 * time.Second,
340341
}
341-
342342
c, err := proxy.NewClient(context.Background(), &fakeDialer{}, testLogger, in)
343343
if err != nil {
344344
t.Fatalf("proxy.NewClient error: %v", err)
345345
}
346346
go c.Serve(context.Background(), func() {})
347347

348-
conn := tryTCPDial(t, "127.0.0.1:5000")
349-
_ = conn.Close()
350-
351-
if err := c.Close(); err != nil {
352-
t.Fatalf("c.Close error: %v", err)
353-
}
354-
355-
in.WaitOnClose = time.Second
356-
in.Port = 5001
357-
c, err = proxy.NewClient(context.Background(), &fakeDialer{}, testLogger, in)
358-
if err != nil {
359-
t.Fatalf("proxy.NewClient error: %v", err)
360-
}
361-
go c.Serve(context.Background(), func() {})
362-
363348
var open []net.Conn
364349
for i := 0; i < 5; i++ {
365-
conn = tryTCPDial(t, "127.0.0.1:5001")
350+
conn := tryTCPDial(t, "127.0.0.1:5000")
366351
open = append(open, conn)
367352
}
368353
defer func() {

0 commit comments

Comments
 (0)