Skip to content

Commit

Permalink
test/xds: fail only when state changes to something other than READY …
Browse files Browse the repository at this point in the history
…and IDLE (#5463)
  • Loading branch information
easwars authored Jun 24, 2022
1 parent c6ee1c7 commit d883f3d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions test/xds/xds_server_serving_mode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,18 @@ func (s) TestServerSideXDS_RedundantUpdateSuppression(t *testing.T) {
// suppressed, server will recycle client connections.
errCh := make(chan error, 1)
go func() {
if cc.WaitForStateChange(ctx, connectivity.Ready) {
errCh <- fmt.Errorf("unexpected connectivity state change {%s --> %s} on the client connection", connectivity.Ready, cc.GetState())
return
prev := connectivity.Ready // We know we are READY since we just did an RPC.
for {
curr := cc.GetState()
if !(curr == connectivity.Ready || curr == connectivity.Idle) {
errCh <- fmt.Errorf("unexpected connectivity state change {%s --> %s} on the client connection", prev, curr)
return
}
if !cc.WaitForStateChange(ctx, curr) {
// Break out of the for loop when the context has been cancelled.
break
}
prev = curr
}
errCh <- nil
}()
Expand Down

0 comments on commit d883f3d

Please sign in to comment.