Repository navigation
Conversation
The test starts and stops four subscribers in a row against one fake server. awaitTerminated() only waits for the client side; the fake removes a stream from its list of opened streams later, when it sees the client's cancellation. If the next subscriber started first, the fake was still tracking the previous stream and the test failed with either "expected:<1> but was:<2>" (opened-stream count) or a stale stream ack deadline such as "expected:<600> but was:<10>". Wait for the fake server to record each closed stream before starting the next subscriber. b/580634974
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates SubscriberTest.java by adding calls to fakeSubscriberServiceImpl.waitForClosedStreams() after terminating the subscriber. This ensures that the fake server asynchronously registers that the stream was closed before proceeding, preventing assertions from incorrectly counting old streams. I have no feedback to provide as there are no review comments.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SubscriberTest.testStreamAckDeadlineIsSetCorrectlystarts and stops four subscribers in a row against oneFakeSubscriberServiceImpl, and it is flaky.subscriber.stopAsync().awaitTerminated()only waits for the client side. The fake removes a stream from its list of opened streams later, when its server thread sees the client's cancellation. If the next subscriber starts before that happens, the fake is still tracking the previous stream and the test fails in one of two ways:expected:<1> but was:<2>: the old and the new stream are both counted as open.expected:<600> but was:<10>: only the old stream is listed so far, sogetLastSeenRequest()returns the previous subscriber's request.This change waits for the fake to record each closed stream (
waitForClosedStreams) before starting the next subscriber. It only touches the test.Verification
Run locally on JDK 25:
mainSubscriberTestpasses (13 tests) andfmt-maven-plugin:checkis clean forgoogle-cloud-pubsub.The failure was seen in
ci / split-units (java-pubsub, 8): https://github.com/googleapis/google-cloud-java/actions/runs/41130804887/job/124321665889. The stale-deadline variant was reported for this test in googleapis/java-pubsub#682.b/580634974