Merge pull request #11819 from gaurav1086/fix_race_cond_client_test

clientv3: fix DialTimeout race condition
This commit is contained in:
Brandon Philips 2020-04-28 15:12:50 -07:00 committed by GitHub
commit eddca8dce2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,14 +100,14 @@ func TestDialTimeout(t *testing.T) {
for i, cfg := range testCfgs { for i, cfg := range testCfgs {
donec := make(chan error, 1) donec := make(chan error, 1)
go func() { go func(cfg Config) {
// without timeout, dial continues forever on ipv4 black hole // without timeout, dial continues forever on ipv4 black hole
c, err := New(cfg) c, err := New(cfg)
if c != nil || err == nil { if c != nil || err == nil {
t.Errorf("#%d: new client should fail", i) t.Errorf("#%d: new client should fail", i)
} }
donec <- err donec <- err
}() }(cfg)
time.Sleep(10 * time.Millisecond) time.Sleep(10 * time.Millisecond)