Skip to content
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

Merged
merged 2 commits into from
Jun 24, 2022

Conversation

easwars
Copy link
Contributor

@easwars easwars commented Jun 23, 2022

TestServerSideXDS_RedundantUpdateSuppression sends a redundant LDS update to an xDS enabled grpc-server, which is currently in SERVING mode and ensures that client connections are not recycled. To accomplish this, it was blocking on connectivity state changes on the ClientConn, and was failing the test if the ClientConn moved away from READY. See:

if cc.WaitForStateChange(ctx, connectivity.Ready) {

The last few flakes have been because the ClientConn is transitioning to IDLE. 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.

xds_server_serving_mode_test.go:149: unexpected connectivity state change {READY --> IDLE} on the client connection

This PR fixes the logic used to check connectivity state on the ClientConn, and does not fail the test if the ClientConn moves to IDLE.

Fixes #4974

RELEASE NOTES: none

@easwars easwars requested a review from zasweq June 23, 2022 19:28
@easwars easwars added this to the 1.48 Release milestone Jun 23, 2022
Copy link
Contributor

@zasweq zasweq left a 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.
Copy link
Contributor

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?

@zasweq zasweq assigned easwars and unassigned zasweq Jun 23, 2022
return
prev := connectivity.Ready // We know we are READY since we just did an RPC.
for {
curr := cc.GetState()
Copy link
Contributor

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?

Copy link
Contributor

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.

@easwars easwars assigned zasweq and unassigned easwars Jun 24, 2022
@zasweq
Copy link
Contributor

zasweq commented Jun 24, 2022

Why did you assign me? You can go ahead and merge this.

@zasweq zasweq assigned easwars and unassigned zasweq Jun 24, 2022
@easwars easwars merged commit d883f3d into grpc:master Jun 24, 2022
@easwars easwars deleted the xds_server_serving_mode_test branch June 24, 2022 17:23
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky test: Test/ServerSideXDS_RedundantUpdateSuppression
2 participants