Browse Source

clientv3/integration: better way to deflake test

Use ReadyNotify instead of time.Sleep to wait for server ready.
Jingyi Hu 6 years ago
parent
commit
7a4d233bab
1 changed files with 2 additions and 3 deletions
  1. 2 3
      clientv3/integration/kv_test.go

+ 2 - 3
clientv3/integration/kv_test.go

@@ -1011,9 +1011,8 @@ func TestKVForLearner(t *testing.T) {
 	}
 	defer cli.Close()
 
-	// TODO: expose servers's ReadyNotify() in test and use it instead.
-	// waiting for learner member to catch up applying the config change entries in raft log.
-	time.Sleep(3 * time.Second)
+	// wait until learner member is ready
+	<-clus.Members[3].ReadyNotify()
 
 	tests := []struct {
 		op   clientv3.Op