Skip to content

Commit

Permalink
chore: increase wait time to ensure TCP connections (GoogleCloudPlatf…
Browse files Browse the repository at this point in the history
  • Loading branch information
enocom authored Sep 21, 2022
1 parent 1d03b71 commit 2ab226c
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions internal/proxy/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,32 +337,17 @@ func TestClientCloseWaitsForActiveConnections(t *testing.T) {
Instances: []proxy.InstanceConnConfig{
{Name: "proj:region:pg"},
},
WaitOnClose: 5 * time.Second,
}

c, err := proxy.NewClient(context.Background(), &fakeDialer{}, testLogger, in)
if err != nil {
t.Fatalf("proxy.NewClient error: %v", err)
}
go c.Serve(context.Background(), func() {})

conn := tryTCPDial(t, "127.0.0.1:5000")
_ = conn.Close()

if err := c.Close(); err != nil {
t.Fatalf("c.Close error: %v", err)
}

in.WaitOnClose = time.Second
in.Port = 5001
c, err = proxy.NewClient(context.Background(), &fakeDialer{}, testLogger, in)
if err != nil {
t.Fatalf("proxy.NewClient error: %v", err)
}
go c.Serve(context.Background(), func() {})

var open []net.Conn
for i := 0; i < 5; i++ {
conn = tryTCPDial(t, "127.0.0.1:5001")
conn := tryTCPDial(t, "127.0.0.1:5000")
open = append(open, conn)
}
defer func() {
Expand Down

0 comments on commit 2ab226c

Please sign in to comment.