@@ -239,7 +239,7 @@ func (s) TestStateTransitions_ReadyToConnecting(t *testing.T) {
239
239
conn .Close ()
240
240
}()
241
241
242
- client , err := grpc .Dial (lis .Addr ().String (),
242
+ client , err := grpc .NewClient (lis .Addr ().String (),
243
243
grpc .WithTransportCredentials (insecure .NewCredentials ()),
244
244
grpc .WithDefaultServiceConfig (fmt .Sprintf (`{"loadBalancingConfig": [{"%s":{}}]}` , stateRecordingBalancerName )))
245
245
if err != nil {
@@ -250,7 +250,7 @@ func (s) TestStateTransitions_ReadyToConnecting(t *testing.T) {
250
250
ctx , cancel := context .WithTimeout (context .Background (), defaultTestTimeout )
251
251
defer cancel ()
252
252
go testutils .StayConnected (ctx , client )
253
-
253
+ testutils . AwaitNotState ( ctx , t , client , connectivity . Idle )
254
254
stateNotifications := testBalancerBuilder .nextStateNotifier ()
255
255
256
256
want := []connectivity.State {
@@ -327,7 +327,7 @@ func (s) TestStateTransitions_TriesAllAddrsBeforeTransientFailure(t *testing.T)
327
327
{Addr : lis1 .Addr ().String ()},
328
328
{Addr : lis2 .Addr ().String ()},
329
329
}})
330
- client , err := grpc .Dial ("whatever:///this-gets-overwritten" ,
330
+ client , err := grpc .NewClient ("whatever:///this-gets-overwritten" ,
331
331
grpc .WithTransportCredentials (insecure .NewCredentials ()),
332
332
grpc .WithDefaultServiceConfig (fmt .Sprintf (`{"loadBalancingConfig": [{"%s":{}}]}` , stateRecordingBalancerName )),
333
333
grpc .WithConnectParams (grpc.ConnectParams {
@@ -342,7 +342,7 @@ func (s) TestStateTransitions_TriesAllAddrsBeforeTransientFailure(t *testing.T)
342
342
t .Fatal (err )
343
343
}
344
344
defer client .Close ()
345
-
345
+ client . Connect ()
346
346
stateNotifications := testBalancerBuilder .nextStateNotifier ()
347
347
want := []connectivity.State {
348
348
connectivity .Connecting ,
@@ -430,15 +430,15 @@ func (s) TestStateTransitions_MultipleAddrsEntersReady(t *testing.T) {
430
430
{Addr : lis1 .Addr ().String ()},
431
431
{Addr : lis2 .Addr ().String ()},
432
432
}})
433
- client , err := grpc .Dial ("whatever:///this-gets-overwritten" ,
433
+ client , err := grpc .NewClient ("whatever:///this-gets-overwritten" ,
434
434
grpc .WithTransportCredentials (insecure .NewCredentials ()),
435
435
grpc .WithDefaultServiceConfig (fmt .Sprintf (`{"loadBalancingConfig": [{"%s":{}}]}` , stateRecordingBalancerName )),
436
436
grpc .WithResolvers (rb ))
437
437
if err != nil {
438
438
t .Fatal (err )
439
439
}
440
440
defer client .Close ()
441
-
441
+ client . Connect ()
442
442
ctx , cancel := context .WithTimeout (context .Background (), defaultTestTimeout )
443
443
defer cancel ()
444
444
go testutils .StayConnected (ctx , client )
@@ -574,15 +574,15 @@ func (s) TestConnectivityStateSubscriber(t *testing.T) {
574
574
// Create the ClientConn.
575
575
const testResName = "any"
576
576
rb := manual .NewBuilderWithScheme (testResName )
577
- cc , err := grpc .Dial (testResName + ":///" ,
577
+ cc , err := grpc .NewClient (testResName + ":///" ,
578
578
grpc .WithResolvers (rb ),
579
579
grpc .WithDefaultServiceConfig (fmt .Sprintf (`{"loadBalancingConfig": [{"%s":{}}]}` , testBalName )),
580
580
grpc .WithTransportCredentials (insecure .NewCredentials ()),
581
581
)
582
582
if err != nil {
583
- t .Fatalf ("Unexpected error from grpc.Dial : %v" , err )
583
+ t .Fatalf ("grpc.NewClient() failed : %v" , err )
584
584
}
585
-
585
+ cc . Connect ()
586
586
// Subscribe to state updates. Use a buffer size of 1 to allow the
587
587
// Shutdown state to go into the channel when Close()ing.
588
588
connCh := make (chan connectivity.State , 1 )
0 commit comments