grpc-go
grpc-go copied to clipboard
xds: Fix flaky test HandleListenerUpdate_ErrorUpdate
Fixes: https://github.com/grpc/grpc-go/issues/8305
After https://github.com/grpc/grpc-go/pull/7977 the server's serving mode started being updated to NOT_SERVING every time a listener resource is NACKed. During the test, the xDS management server replies with the same resource version if a after client NACKs a resource. The test registers a callback that pushes the serving mode state updates to a buffered channel of size 1. The channel gets filled and blocks the test indefinitely.
This PR ensures we only keep the latest serving mode in the channel to avoid deadlocks. Verified that the test doesn't flake in 100k runs on forge.
RELEASE NOTES: N/A