|
@@ -17,7 +17,6 @@ package integration
|
|
|
import (
|
|
import (
|
|
|
"bytes"
|
|
"bytes"
|
|
|
"context"
|
|
"context"
|
|
|
- "math/rand"
|
|
|
|
|
"os"
|
|
"os"
|
|
|
"reflect"
|
|
"reflect"
|
|
|
"strings"
|
|
"strings"
|
|
@@ -825,35 +824,6 @@ func TestKVPutStoppedServerAndClose(t *testing.T) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// TestKVGetOneEndpointDown ensures a client can connect and get if one endpoint is down.
|
|
|
|
|
-func TestKVGetOneEndpointDown(t *testing.T) {
|
|
|
|
|
- defer testutil.AfterTest(t)
|
|
|
|
|
- clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 3, SkipCreatingClient: true})
|
|
|
|
|
- defer clus.Terminate(t)
|
|
|
|
|
-
|
|
|
|
|
- // get endpoint list
|
|
|
|
|
- eps := make([]string, 3)
|
|
|
|
|
- for i := range eps {
|
|
|
|
|
- eps[i] = clus.Members[i].GRPCAddr()
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // make a dead node
|
|
|
|
|
- clus.Members[rand.Intn(len(eps))].Stop(t)
|
|
|
|
|
-
|
|
|
|
|
- // try to connect with dead node in the endpoint list
|
|
|
|
|
- cfg := clientv3.Config{Endpoints: eps, DialTimeout: 1 * time.Second}
|
|
|
|
|
- cli, err := clientv3.New(cfg)
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- t.Fatal(err)
|
|
|
|
|
- }
|
|
|
|
|
- defer cli.Close()
|
|
|
|
|
- ctx, cancel := context.WithTimeout(context.TODO(), 3*time.Second)
|
|
|
|
|
- if _, err := cli.Get(ctx, "abc", clientv3.WithSerializable()); err != nil {
|
|
|
|
|
- t.Fatal(err)
|
|
|
|
|
- }
|
|
|
|
|
- cancel()
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
// TestKVGetResetLoneEndpoint ensures that if an endpoint resets and all other
|
|
// TestKVGetResetLoneEndpoint ensures that if an endpoint resets and all other
|
|
|
// endpoints are down, then it will reconnect.
|
|
// endpoints are down, then it will reconnect.
|
|
|
func TestKVGetResetLoneEndpoint(t *testing.T) {
|
|
func TestKVGetResetLoneEndpoint(t *testing.T) {
|