test: fix race reading while incrementing (#2935)

Swap the `<-done` and `if numConns < 2` to make sure `numConns++` happens before read
This commit is contained in:
Zeming YU 2019-07-25 10:54:14 -07:00 committed by Menghan Li
parent b5748caae7
commit 6d6c0413c7
1 changed files with 1 additions and 1 deletions

View File

@ -232,10 +232,10 @@ func (s) TestDialWaitsForServerSettingsAndFails(t *testing.T) {
if err != context.DeadlineExceeded {
t.Fatalf("DialContext(_) = %v; want context.DeadlineExceeded", err)
}
<-done
if numConns < 2 {
t.Fatalf("dial attempts: %v; want > 1", numConns)
}
<-done
}
// 1. Client connects to a server that doesn't send preface.