Skip to content

Commit 282576c

Browse files
arjan-baljanardhankrishna-sai
authored andcommitted
priority: Send and validate connection error in test (grpc#8143)
1 parent 47a613e commit 282576c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

xds/internal/balancer/priority/balancer_test.go

+10-3
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,11 @@ func (s) TestPriority_HigherDownWhileAddingLower(t *testing.T) {
493493
sc0 := <-cc.NewSubConnCh
494494

495495
t.Log("Turn down 0, 1 is used.")
496-
sc0.UpdateState(balancer.SubConnState{ConnectivityState: connectivity.TransientFailure})
496+
testErr := errors.New("test error")
497+
sc0.UpdateState(balancer.SubConnState{
498+
ConnectivityState: connectivity.TransientFailure,
499+
ConnectionError: testErr,
500+
})
497501

498502
// Before 1 gets READY, picker should return NoSubConnAvailable, so RPCs
499503
// will retry.
@@ -508,10 +512,13 @@ func (s) TestPriority_HigherDownWhileAddingLower(t *testing.T) {
508512
sc1 := <-cc.NewSubConnCh
509513

510514
t.Log("Turn down 1, pick should error.")
511-
sc1.UpdateState(balancer.SubConnState{ConnectivityState: connectivity.TransientFailure})
515+
sc1.UpdateState(balancer.SubConnState{
516+
ConnectivityState: connectivity.TransientFailure,
517+
ConnectionError: testErr,
518+
})
512519

513520
// Test pick failure.
514-
if err := cc.WaitForErrPicker(ctx); err != nil {
521+
if err := cc.WaitForPickerWithErr(ctx, testErr); err != nil {
515522
t.Fatal(err.Error())
516523
}
517524
<-cc.NewStateCh // Drain to match picker

0 commit comments

Comments
 (0)