Repository navigation
fix: add awaitChildQueueCountStable to subscribe tests to prevent race condition - #903
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates AbstractA2AServerTest.java to ensure that the EventConsumer polling loop has started before enqueuing events in the testSubscribeExistingTaskSuccess and testSubscribeExistingTaskSuccessWithClientConsumers test cases. This is achieved by waiting for the child queue count to become stable. There are no review comments, and I have no feedback to provide.
…be tests The subscribe tests were flaky because events were enqueued on the server before the EventConsumer polling loop had started. awaitStreamingSubscription() only guarantees transport-level subscription, not consumer readiness. The fix captures the child queue count before subscribing and waits for it to increment, confirming the subscription's EventConsumer is actively polling. This is more robust than awaitChildQueueCountStable with a fixed expected count, since ensureQueueForTask creates a child queue that remains in the count. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
476c497 to
ea61e0f
Compare
There was a problem hiding this comment.
Code Review
This pull request updates the test suite in AbstractA2AServerTest.java to ensure that the EventConsumer polling loop has started before enqueuing events, preventing potential race conditions. The reviewer pointed out that using waitForChildQueueCountToBe is inefficient and can lead to socket exhaustion due to client-side polling. They suggested replacing it with awaitChildQueueCountStable to offload polling to the server side and ensure stability.
…ps/common/AbstractA2AServerTest.java Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…ps/common/AbstractA2AServerTest.java Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

Summary
awaitChildQueueCountStable()synchronization totestSubscribeExistingTaskSuccessandtestSubscribeExistingTaskSuccessWithClientConsumersinAbstractA2AServerTestawaitStreamingSubscription()only guarantees transport-level subscription (Flow.Subscriber.onSubscribe()called), but theEventConsumerpolling loop starts asynchronously on a separate thread. Without waiting for the child queue to stabilize, events enqueued on the server can be lost if they fire before the consumer is ready to receive them-faeto ban downstream modules likequarkus-app-1/quarkus-app-2, failingMultiInstanceReplicationTestwith a Docker build-context errortestResubscriptionPreservesEventsFromBothStreams(line ~1739)Test plan
QuarkusA2AJSONRPCVertxTest.testSubscribeExistingTaskSuccessno longer times outMultiInstanceReplicationTestno longer fails due to cascading ban🤖 Generated with Claude Code