Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clientv3/integration: fix TestSetEndpointAndPut dial tests #8869

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions clientv3/integration/dial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,19 @@ func TestDialForeignEndpoint(t *testing.T) {
}

// TestSetEndpointAndPut checks that a Put following a SetEndpoints
// to a working endpoint will always succeed.
// to a working endpoint succeeds with the new endpoint or returns
// gRPC transport errors.
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") {
// grpc/transport.ErrConnClosing or grpc/transport.ErrConnDrain on balancer endpoint switch
if err != nil &&
!strings.Contains(err.Error(), "transport is closing") &&
!strings.Contains(err.Error(), "the server stops accepting new RPCs") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we might receive a server side error triggered by a endpoint switch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Balancer switch might not have completed, so errors return while gRPC drains current connection and creates a new sub connection.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

transport is closing makes sense. i was asking why we can see the server stops.... gRPC client draining connection has nothing to do with the server.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gRPC client draining connection has nothing to do with the server.

This error message is more about gRPC http/2 client telling the current connection has been drained.

  1. tearDown on current *addrConn(errConnDrain)
  2. ac.transport.GracefulClose() that prevents new streams from being created, setting the connection state to drain

So, it is the http2Client that returns ErrStreamDrain error, not from the server.

t.Fatal(err)
}
}