@@ -97,20 +97,11 @@ func callAndVerify(ctx context.Context, msg string, client pb.GreeterClient, sho
9797// TODO(ZhenLian): remove shouldFail and add ...DialOption to the function
9898// signature to provider cleaner tests.
9999func callAndVerifyWithClientConn (ctx context.Context , address string , msg string , creds credentials.TransportCredentials , shouldFail bool ) (* grpc.ClientConn , pb.GreeterClient , error ) {
100- var conn * grpc.ClientConn
101- var err error
102- // If we want the test to fail, we establish a non-blocking connection to
103- // avoid it hangs and killed by the context.
104- if shouldFail {
105- conn , err = grpc .NewClient (address , grpc .WithTransportCredentials (creds ))
106- if err != nil {
107- return nil , nil , fmt .Errorf ("client failed to connect to %s. Error: %v" , address , err )
108- }
109- } else {
110- conn , err = grpc .NewClient (address , grpc .WithTransportCredentials (creds ), grpc .WithBlock ())
111- if err != nil {
112- return nil , nil , fmt .Errorf ("client failed to connect to %s. Error: %v" , address , err )
113- }
100+ // Disable service config lookups as it results in a DNS lookup which can
101+ // flake in CI.
102+ conn , err := grpc .NewClient (address , grpc .WithTransportCredentials (creds ), grpc .WithDisableServiceConfig ())
103+ if err != nil {
104+ return nil , nil , fmt .Errorf ("client failed to connect to %s. Error: %v" , address , err )
114105 }
115106 greetClient := pb .NewGreeterClient (conn )
116107 err = callAndVerify (ctx , msg , greetClient , shouldFail )
0 commit comments