@@ -30,15 +30,14 @@ import (
30
30
"google.golang.org/grpc"
31
31
"google.golang.org/grpc/balancer"
32
32
"google.golang.org/grpc/balancer/pickfirst"
33
- "google.golang.org/grpc/balancer/pickfirst/pickfirstleaf "
33
+ "google.golang.org/grpc/balancer/roundrobin "
34
34
"google.golang.org/grpc/codes"
35
35
"google.golang.org/grpc/connectivity"
36
36
"google.golang.org/grpc/credentials/insecure"
37
37
"google.golang.org/grpc/health"
38
38
"google.golang.org/grpc/internal"
39
39
"google.golang.org/grpc/internal/balancer/stub"
40
40
"google.golang.org/grpc/internal/channelz"
41
- "google.golang.org/grpc/internal/envconfig"
42
41
"google.golang.org/grpc/internal/grpctest"
43
42
"google.golang.org/grpc/internal/testutils"
44
43
"google.golang.org/grpc/resolver"
@@ -51,47 +50,6 @@ import (
51
50
testpb "google.golang.org/grpc/interop/grpc_testing"
52
51
)
53
52
54
- const healthCheckingPetiolePolicyName = "health_checking_petiole_policy"
55
-
56
- var (
57
- // healthCheckTestPolicyName is the LB policy used for testing the health check
58
- // service.
59
- healthCheckTestPolicyName = "round_robin"
60
- )
61
-
62
- func init () {
63
- balancer .Register (& healthCheckingPetiolePolicyBuilder {})
64
- // Till dualstack changes are not implemented and round_robin doesn't
65
- // delegate to pickfirst, test a fake petiole policy that delegates to
66
- // the new pickfirst balancer.
67
- // TODO: https://github.com/grpc/grpc-go/issues/7906 - Remove the fake
68
- // petiole policy one round robin starts delegating to pickfirst.
69
- if envconfig .NewPickFirstEnabled {
70
- healthCheckTestPolicyName = healthCheckingPetiolePolicyName
71
- }
72
- }
73
-
74
- type healthCheckingPetiolePolicyBuilder struct {}
75
-
76
- func (bb * healthCheckingPetiolePolicyBuilder ) Build (cc balancer.ClientConn , opts balancer.BuildOptions ) balancer.Balancer {
77
- return & healthCheckingPetiolePolicy {
78
- Balancer : balancer .Get (pickfirstleaf .Name ).Build (cc , opts ),
79
- }
80
- }
81
-
82
- func (bb * healthCheckingPetiolePolicyBuilder ) Name () string {
83
- return healthCheckingPetiolePolicyName
84
- }
85
-
86
- func (b * healthCheckingPetiolePolicy ) UpdateClientConnState (state balancer.ClientConnState ) error {
87
- state .ResolverState = pickfirstleaf .EnableHealthListener (state .ResolverState )
88
- return b .Balancer .UpdateClientConnState (state )
89
- }
90
-
91
- type healthCheckingPetiolePolicy struct {
92
- balancer.Balancer
93
- }
94
-
95
53
func newTestHealthServer () * testHealthServer {
96
54
return newTestHealthServerWithWatchFunc (defaultWatchFunc )
97
55
}
@@ -312,7 +270,7 @@ func (s) TestHealthCheckHealthServerNotRegistered(t *testing.T) {
312
270
"serviceName": "foo"
313
271
},
314
272
"loadBalancingConfig": [{"%s":{}}]
315
- }` , healthCheckTestPolicyName ))})
273
+ }` , roundrobin . Name ))})
316
274
317
275
ctx , cancel := context .WithTimeout (context .Background (), defaultTestTimeout )
318
276
defer cancel ()
@@ -339,7 +297,7 @@ func (s) TestHealthCheckWithGoAway(t *testing.T) {
339
297
"serviceName": "foo"
340
298
},
341
299
"loadBalancingConfig": [{"%s":{}}]
342
- }` , healthCheckTestPolicyName ))})
300
+ }` , roundrobin . Name ))})
343
301
344
302
ctx , cancel := context .WithTimeout (context .Background (), defaultTestTimeout )
345
303
defer cancel ()
@@ -417,7 +375,7 @@ func (s) TestHealthCheckWithConnClose(t *testing.T) {
417
375
"serviceName": "foo"
418
376
},
419
377
"loadBalancingConfig": [{"%s":{}}]
420
- }` , healthCheckTestPolicyName ))})
378
+ }` , roundrobin . Name ))})
421
379
422
380
ctx , cancel := context .WithTimeout (context .Background (), defaultTestTimeout )
423
381
defer cancel ()
@@ -465,7 +423,7 @@ func (s) TestHealthCheckWithAddrConnDrain(t *testing.T) {
465
423
"serviceName": "foo"
466
424
},
467
425
"loadBalancingConfig": [{"%s":{}}]
468
- }` , healthCheckTestPolicyName ))
426
+ }` , roundrobin . Name ))
469
427
r .UpdateState (resolver.State {
470
428
Addresses : []resolver.Address {{Addr : lis .Addr ().String ()}},
471
429
ServiceConfig : sc ,
@@ -547,7 +505,7 @@ func (s) TestHealthCheckWithClientConnClose(t *testing.T) {
547
505
"serviceName": "foo"
548
506
},
549
507
"loadBalancingConfig": [{"%s":{}}]
550
- }` , healthCheckTestPolicyName )))})
508
+ }` , roundrobin . Name )))})
551
509
552
510
ctx , cancel := context .WithTimeout (context .Background (), defaultTestTimeout )
553
511
defer cancel ()
@@ -614,7 +572,7 @@ func (s) TestHealthCheckWithoutSetConnectivityStateCalledAddrConnShutDown(t *tes
614
572
"serviceName": "delay"
615
573
},
616
574
"loadBalancingConfig": [{"%s":{}}]
617
- }` , healthCheckTestPolicyName ))
575
+ }` , roundrobin . Name ))
618
576
r .UpdateState (resolver.State {
619
577
Addresses : []resolver.Address {{Addr : lis .Addr ().String ()}},
620
578
ServiceConfig : sc ,
@@ -679,7 +637,7 @@ func (s) TestHealthCheckWithoutSetConnectivityStateCalled(t *testing.T) {
679
637
"serviceName": "delay"
680
638
},
681
639
"loadBalancingConfig": [{"%s":{}}]
682
- }` , healthCheckTestPolicyName ))})
640
+ }` , roundrobin . Name ))})
683
641
684
642
select {
685
643
case <- hcExitChan :
@@ -717,7 +675,7 @@ func testHealthCheckDisableWithDialOption(t *testing.T, addr string) {
717
675
"serviceName": "foo"
718
676
},
719
677
"loadBalancingConfig": [{"%s":{}}]
720
- }` , healthCheckTestPolicyName ))})
678
+ }` , roundrobin . Name ))})
721
679
722
680
ctx , cancel := context .WithTimeout (context .Background (), defaultTestTimeout )
723
681
defer cancel ()
@@ -823,7 +781,7 @@ func (s) TestHealthCheckChannelzCountingCallSuccess(t *testing.T) {
823
781
"serviceName": "channelzSuccess"
824
782
},
825
783
"loadBalancingConfig": [{"%s":{}}]
826
- }` , healthCheckTestPolicyName ))})
784
+ }` , roundrobin . Name ))})
827
785
828
786
if err := verifyResultWithDelay (func () (bool , error ) {
829
787
cm , _ := channelz .GetTopChannels (0 , 0 )
@@ -872,7 +830,7 @@ func (s) TestHealthCheckChannelzCountingCallFailure(t *testing.T) {
872
830
"serviceName": "channelzFailure"
873
831
},
874
832
"loadBalancingConfig": [{"%s":{}}]
875
- }` , healthCheckTestPolicyName ))})
833
+ }` , roundrobin . Name ))})
876
834
877
835
if err := verifyResultWithDelay (func () (bool , error ) {
878
836
cm , _ := channelz .GetTopChannels (0 , 0 )
@@ -985,7 +943,7 @@ func (s) TestHealthCheckFailure(t *testing.T) {
985
943
name : "tcp-tls" ,
986
944
network : "tcp" ,
987
945
security : "tls" ,
988
- balancer : healthCheckTestPolicyName ,
946
+ balancer : roundrobin . Name ,
989
947
}
990
948
te := newTest (t , e )
991
949
te .declareLogNoise (
0 commit comments