diff --git a/resolver_balancer_ext_test.go b/resolver_balancer_ext_test.go index 2f187e8a32f9..75fac51a66db 100644 --- a/resolver_balancer_ext_test.go +++ b/resolver_balancer_ext_test.go @@ -57,7 +57,7 @@ func (s) TestResolverBalancerInteraction(t *testing.T) { rb := manual.NewBuilderWithScheme(name) rb.BuildCallback = func(_ resolver.Target, cc resolver.ClientConn, _ resolver.BuildOptions) { sc := cc.ParseServiceConfig(`{"loadBalancingConfig": [{"` + name + `":{}}]}`) - rb.InitialState(resolver.State{ + cc.UpdateState(resolver.State{ Addresses: []resolver.Address{{Addr: "test"}}, ServiceConfig: sc, }) diff --git a/test/creds_test.go b/test/creds_test.go index 6fe5e2455771..f0a964cf293f 100644 --- a/test/creds_test.go +++ b/test/creds_test.go @@ -428,7 +428,6 @@ func (s) TestCredsHandshakeAuthority(t *testing.T) { if err != nil { t.Fatal(err) } - defer lis.Close() cred := &authorityCheckCreds{} s := grpc.NewServer() @@ -437,10 +436,6 @@ func (s) TestCredsHandshakeAuthority(t *testing.T) { r := manual.NewBuilderWithScheme("whatever") - r.InitialState(resolver.State{ - Addresses: []resolver.Address{{Addr: lis.Addr().String()}}, - }) - cc, err := grpc.NewClient(r.Scheme()+":///"+testAuthority, grpc.WithTransportCredentials(cred), grpc.WithResolvers(r)) if err != nil { t.Fatalf("grpc.NewClient(%q) = %v", lis.Addr().String(), err) @@ -448,6 +443,8 @@ func (s) TestCredsHandshakeAuthority(t *testing.T) { cc.Connect() defer cc.Close() + r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: lis.Addr().String()}}}) + ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) defer cancel() testutils.AwaitState(ctx, t, cc, connectivity.Ready) @@ -467,20 +464,19 @@ func (s) TestCredsHandshakeServerNameAuthority(t *testing.T) { t.Fatal(err) } cred := &authorityCheckCreds{} - defer lis.Close() - s := grpc.NewServer() go s.Serve(lis) defer s.Stop() r := manual.NewBuilderWithScheme("whatever") - r.InitialState(resolver.State{Addresses: []resolver.Address{{Addr: lis.Addr().String(), ServerName: testServerName}}}) + cc, err := grpc.NewClient(r.Scheme()+":///"+testAuthority, grpc.WithTransportCredentials(cred), grpc.WithResolvers(r)) if err != nil { t.Fatalf("grpc.NewClient(%q) = %v", lis.Addr().String(), err) } cc.Connect() defer cc.Close() + r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: lis.Addr().String(), ServerName: testServerName}}}) ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) defer cancel()