Skip to content

Commit

Permalink
chore: wait for EOF for longer duration (GoogleCloudPlatform#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
enocom authored Jul 26, 2022
1 parent 232f27d commit 1e7b33e
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions internal/proxy/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,19 +270,14 @@ func TestClientLimitsMaxConnections(t *testing.T) {
}
defer conn2.Close()

// try to read to check if the connection is closed
// wait only a second for the result (since nothing is writing to the
// socket)
conn2.SetReadDeadline(time.Now().Add(time.Second))

wantEOF := func(t *testing.T, c net.Conn) {
var got error
for i := 0; i < 10; i++ {
_, got = c.Read(make([]byte, 1))
if got == io.EOF {
return
}
time.Sleep(500 * time.Millisecond)
time.Sleep(time.Second)
}
t.Fatalf("conn.Read should return io.EOF, got = %v", got)
}
Expand Down

0 comments on commit 1e7b33e

Please sign in to comment.