mirror of https://github.com/grpc/grpc-go.git
test/xds: fail only when state changes to something other than READY and IDLE (#5463)
This commit is contained in:
parent
c6ee1c7144
commit
d883f3d5fa
|
|
@ -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
|
||||
}()
|
||||
|
|
|
|||
Loading…
Reference in New Issue