Explorar o código

clientv3/integration: increase balancer switch timeout for TestKVGetResetLoneEndpoint

Since 3-second is the minimum time to keep an endpoint in unhealthy,
it is possible that endpoint switch happens right after context timeout.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
Gyu-Ho Lee %!s(int64=8) %!d(string=hai) anos
pai
achega
2c13231e7b
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      clientv3/integration/kv_test.go

+ 5 - 1
clientv3/integration/kv_test.go

@@ -881,7 +881,11 @@ func TestKVGetResetLoneEndpoint(t *testing.T) {
 	// have Get try to reconnect
 	donec := make(chan struct{})
 	go func() {
-		ctx, cancel := context.WithTimeout(context.TODO(), 5*time.Second)
+		// 3-second is the minimum interval between endpoint being marked
+		// as unhealthy and being removed from unhealthy, so possibly
+		// takes >5-second to unpin and repin an endpoint
+		// TODO: decrease timeout when balancer switch rewrite
+		ctx, cancel := context.WithTimeout(context.TODO(), 7*time.Second)
 		if _, err := cli.Get(ctx, "abc", clientv3.WithSerializable()); err != nil {
 			t.Fatal(err)
 		}