Skip to content

Commit

Permalink
replace dial with newclient
Browse files Browse the repository at this point in the history
  • Loading branch information
janardhankrishna-sai committed Dec 23, 2024
1 parent 10c7e13 commit 7ddbe46
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
5 changes: 3 additions & 2 deletions test/goaway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -672,11 +672,12 @@ func (s) TestGoAwayStreamIDSmallerThanCreatedStreams(t *testing.T) {
ctCh.Send(ct)
}()

cc, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials()))
cc, err := grpc.NewClient(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
t.Fatalf("error dialing: %v", err)
t.Fatalf("NewClient() failed: %v", err)
}
defer cc.Close()
cc.Connect()

ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
Expand Down
5 changes: 3 additions & 2 deletions test/healthcheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,11 @@ func setupClient(t *testing.T, c *clientConfig) (*grpc.ClientConn, *manual.Resol
opts = append(opts, c.extraDialOption...)
}

cc, err := grpc.Dial(r.Scheme()+":///test.server", opts...)
cc, err := grpc.NewClient(r.Scheme()+":///test.server", opts...)
if err != nil {
t.Fatalf("grpc.Dial() failed: %v", err)
t.Fatalf("grpc.NewClient() failed: %v", err)
}
cc.Connect()
t.Cleanup(func() { cc.Close() })
return cc, r
}
Expand Down
12 changes: 6 additions & 6 deletions test/resolver_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ func (s) TestResolverUpdateDuringBuild_ServiceConfigInvalidTypeError(t *testing.
func (s) TestResolverUpdate_InvalidServiceConfigAsFirstUpdate(t *testing.T) {
r := manual.NewBuilderWithScheme("whatever")

cc, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithResolvers(r))
cc, err := grpc.NewClient(r.Scheme()+":///test.server", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithResolvers(r))
if err != nil {
t.Fatalf("Dial(_, _) = _, %v; want _, nil", err)
t.Fatalf("NewClient(_, _) = _, %v; want _, nil", err)
}
defer cc.Close()

cc.Connect()
scpr := r.CC.ParseServiceConfig("bad json service config")
r.UpdateState(resolver.State{ServiceConfig: scpr})

Expand Down Expand Up @@ -195,12 +195,12 @@ func (s) TestResolverUpdate_InvalidServiceConfigAfterGoodUpdate(t *testing.T) {

r := manual.NewBuilderWithScheme("whatever")

cc, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithResolvers(r))
cc, err := grpc.NewClient(r.Scheme()+":///test.server", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithResolvers(r))
if err != nil {
t.Fatalf("Dial(_, _) = _, %v; want _, nil", err)
t.Fatalf("NewClient(_, _) = _, %v; want _, nil", err)
}
defer cc.Close()

cc.Connect()
// Push a resolver update and verify that our balancer receives the update.
addrs := []resolver.Address{{Addr: backend.Address}}
const lbCfg = "wrapping balancer LB policy config"
Expand Down
5 changes: 3 additions & 2 deletions test/xds/xds_client_certificate_providers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,12 @@ func (s) TestClientSideXDS_WithNoCertificateProvidersInBootstrap_Failure(t *test
}

// Create a ClientConn and ensure that it moves to TRANSIENT_FAILURE.
cc, err := grpc.Dial(fmt.Sprintf("xds:///%s", serviceName), grpc.WithTransportCredentials(creds), grpc.WithResolvers(resolverBuilder))
cc, err := grpc.NewClient(fmt.Sprintf("xds:///%s", serviceName), grpc.WithTransportCredentials(creds), grpc.WithResolvers(resolverBuilder))
if err != nil {
t.Fatalf("failed to dial local test server: %v", err)
t.Fatalf("NewClient() failed: %v", err)
}
defer cc.Close()
cc.Connect()
testutils.AwaitState(ctx, t, cc, connectivity.TransientFailure)

// Make an RPC and ensure that expected error is returned.
Expand Down

0 comments on commit 7ddbe46

Please sign in to comment.