Skip to content

Commit

Permalink
clientv3/integration: test Put succeeds following SetEndpoint
Browse files Browse the repository at this point in the history
Still gets transport closing errors, but no unavailable endpoint errors.
  • Loading branch information
Anthony Romano committed Aug 1, 2017
1 parent 10db031 commit fdba9e5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions clientv3/integration/dial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package integration

import (
"math/rand"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -189,3 +190,17 @@ func TestDialForeignEndpoint(t *testing.T) {
t.Fatal(err)
}
}

// TestSetEndpointAndPut checks that a Put following a SetEndpoint
// to a working endpoint will always succeed.
func TestSetEndpointAndPut(t *testing.T) {
defer testutil.AfterTest(t)
clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 2})
defer clus.Terminate(t)

clus.Client(1).SetEndpoints(clus.Members[0].GRPCAddr())
_, err := clus.Client(1).Put(context.TODO(), "foo", "bar")
if err != nil && !strings.Contains(err.Error(), "closing") {
t.Fatal(err)
}
}

0 comments on commit fdba9e5

Please sign in to comment.