Skip to content

Commit 9d6a6ba

Browse files
committed
More test timing fixes
1 parent 87e7e78 commit 9d6a6ba

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

extras/queue-manager-replicated/core/src/test/java/io/a2a/extras/queuemanager/replicated/core/ReplicatedQueueManagerTest.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,19 +149,21 @@ void testReplicatedEventCreatesQueueIfNeeded() throws InterruptedException {
149149
// Verify no queue exists initially
150150
assertNull(queueManager.get(taskId));
151151

152+
// Create a ChildQueue BEFORE processing the replicated event
153+
// This ensures the ChildQueue exists when MainEventBusProcessor distributes the event
154+
EventQueue childQueue = queueManager.createOrTap(taskId);
155+
assertNotNull(childQueue, "ChildQueue should be created");
156+
157+
// Verify MainQueue was created
158+
EventQueue mainQueue = queueManager.get(taskId);
159+
assertNotNull(mainQueue, "MainQueue should exist after createOrTap");
160+
152161
ReplicatedEventQueueItem replicatedEvent = new ReplicatedEventQueueItem(taskId, testEvent);
153162

154163
// Process the replicated event
155164
assertDoesNotThrow(() -> queueManager.onReplicatedEvent(replicatedEvent));
156165

157-
// Verify that a queue was created and the event was enqueued
158-
EventQueue queue = queueManager.get(taskId);
159-
assertNotNull(queue, "Queue should be created when processing replicated event for non-existent task");
160-
161-
// Verify the event was enqueued by dequeuing it
162-
// Need to tap() the MainQueue to get a ChildQueue for consumption
163-
EventQueue childQueue = queue.tap();
164-
166+
// Verify the event was enqueued and distributed to our ChildQueue
165167
// Use retry logic to handle async MainEventBusProcessor distribution
166168
EventQueueItem item = dequeueEventWithRetry(childQueue, 5000);
167169
assertNotNull(item, "Event should be available in queue");

0 commit comments

Comments
 (0)