-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test/xds: fail only when state changes to something other than READY and IDLE #5463
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Kind of fun to try and break this but I couldn't.
return | ||
} | ||
if !cc.WaitForStateChange(ctx, curr) { | ||
// Break out of the for loop when the context has been cancelled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: is this comment needed?
return | ||
prev := connectivity.Ready // We know we are READY since we just did an RPC. | ||
for { | ||
curr := cc.GetState() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
qq: what happens if the context gets cancelled when you are here. Will the WaitForStateChange call later still return false? It reads the ctx.Done() channel which has already been closed, will this Done channel still send a zero value that signifies it's been closed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Successive calls to Done return the same value."
"A receive operation on a closed channel can always proceed immediately, yielding the element type's zero value after any previously sent values have been received."
I think these statements from godoc mean the answer to my question is yes, but just making sure.
Why did you assign me? You can go ahead and merge this. |
TestServerSideXDS_RedundantUpdateSuppression
sends a redundant LDS update to an xDS enabled grpc-server, which is currently inSERVING
mode and ensures that client connections are not recycled. To accomplish this, it was blocking on connectivity state changes on theClientConn
, and was failing the test if theClientConn
moved away fromREADY
. See:grpc-go/test/xds/xds_server_serving_mode_test.go
Line 115 in 5cdb09f
The last few flakes have been because the
ClientConn
is transitioning toIDLE
. This is expected behavior since we don't have an ongoing stream of RPCs from the test. Therefore we should not fail the test for this.This PR fixes the logic used to check connectivity state on the
ClientConn
, and does not fail the test if theClientConn
moves toIDLE
.Fixes #4974
RELEASE NOTES: none