ソースを参照

clientv3/integration: better way to deflake test

Use ReadyNotify instead of time.Sleep to wait for server ready.
Jingyi Hu 6 年 前
コミット
7a4d233bab
1 ファイル変更2 行追加3 行削除
  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