Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: increase wait time to ensure TCP connections #1293

Merged
merged 1 commit into from
Aug 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions internal/proxy/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,32 +354,17 @@ func TestClientCloseWaitsForActiveConnections(t *testing.T) {
Instances: []proxy.InstanceConnConfig{
{Name: "proj:region:pg"},
},
WaitOnClose: 5 * time.Second,
}

c, err := proxy.NewClient(context.Background(), &fakeDialer{}, logger, 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{}, logger, 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