From 5565631455d326987ad3f9dba6d45478cc426c9f Mon Sep 17 00:00:00 2001 From: hanut19 <50198451+hanut19@users.noreply.github.com> Date: Wed, 4 Dec 2024 11:01:22 +0530 Subject: [PATCH] balancer/pickfirst: replace grpc.Dial with grpc.NewClient in tests (#7879) --- balancer/pickfirst/pickfirst_ext_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/balancer/pickfirst/pickfirst_ext_test.go b/balancer/pickfirst/pickfirst_ext_test.go index faa6e7dd274e..4354009fcaec 100644 --- a/balancer/pickfirst/pickfirst_ext_test.go +++ b/balancer/pickfirst/pickfirst_ext_test.go @@ -376,12 +376,12 @@ func (s) TestPickFirst_StickyTransientFailure(t *testing.T) { }, }), } - cc, err := grpc.Dial(lis.Addr().String(), dopts...) + cc, err := grpc.NewClient(lis.Addr().String(), dopts...) if err != nil { - t.Fatalf("Failed to dial server at %q: %v", lis.Addr(), err) + t.Fatalf("Failed to create new client: %v", err) } t.Cleanup(func() { cc.Close() }) - + cc.Connect() testutils.AwaitState(ctx, t, cc, connectivity.TransientFailure) // Spawn a goroutine to ensure that the channel stays in TransientFailure. @@ -837,12 +837,12 @@ func (s) TestPickFirst_ResolverError_WithPreviousUpdate_Connecting(t *testing.T) grpc.WithResolvers(r), grpc.WithDefaultServiceConfig(pickFirstServiceConfig), } - cc, err := grpc.Dial(r.Scheme()+":///test.server", dopts...) + cc, err := grpc.NewClient(r.Scheme()+":///test.server", dopts...) if err != nil { - t.Fatalf("grpc.Dial() failed: %v", err) + t.Fatalf("grpc.NewClient() failed: %v", err) } t.Cleanup(func() { cc.Close() }) - + cc.Connect() addrs := []resolver.Address{{Addr: lis.Addr().String()}} r.UpdateState(resolver.State{Addresses: addrs}) testutils.AwaitState(ctx, t, cc, connectivity.Connecting) @@ -892,12 +892,12 @@ func (s) TestPickFirst_ResolverError_WithPreviousUpdate_TransientFailure(t *test grpc.WithResolvers(r), grpc.WithDefaultServiceConfig(pickFirstServiceConfig), } - cc, err := grpc.Dial(r.Scheme()+":///test.server", dopts...) + cc, err := grpc.NewClient(r.Scheme()+":///test.server", dopts...) if err != nil { - t.Fatalf("grpc.Dial() failed: %v", err) + t.Fatalf("grpc.NewClient() failed: %v", err) } t.Cleanup(func() { cc.Close() }) - + cc.Connect() addrs := []resolver.Address{{Addr: lis.Addr().String()}} r.UpdateState(resolver.State{Addresses: addrs}) ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)