Fix Test: Update the deadline since small deadlines are prone to flakes on Travis. (#1932)

This commit is contained in:
mmukhi
2018-03-20 16:46:10 -07:00
committed by GitHub
parent 2249df6df9
commit 031ee13cfe

View File

@ -149,9 +149,9 @@ func TestDialWaitsForServerSettings(t *testing.T) {
return return
} }
defer conn.Close() defer conn.Close()
// Sleep so that if the test were to fail it // Sleep for a little bit to make sure that Dial on client
// will fail more often than not. // side blocks until settings are received.
time.Sleep(100 * time.Millisecond) time.Sleep(500 * time.Millisecond)
framer := http2.NewFramer(conn, conn) framer := http2.NewFramer(conn, conn)
close(sent) close(sent)
if err := framer.WriteSettings(http2.Setting{}); err != nil { if err := framer.WriteSettings(http2.Setting{}); err != nil {
@ -160,7 +160,7 @@ func TestDialWaitsForServerSettings(t *testing.T) {
} }
<-dialDone // Close conn only after dial returns. <-dialDone // Close conn only after dial returns.
}() }()
ctx, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond) ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel() defer cancel()
client, err := DialContext(ctx, server.Addr().String(), WithInsecure(), WithWaitForHandshake(), WithBlock()) client, err := DialContext(ctx, server.Addr().String(), WithInsecure(), WithWaitForHandshake(), WithBlock())
close(dialDone) close(dialDone)