File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
server-common/src/test/java/io/a2a/server/requesthandlers Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -809,7 +809,23 @@ void testBlockingCallReturnsCompleteTaskWithArtifacts() throws Exception {
809809 assertTrue (result instanceof Task , "Result should be a Task" );
810810 Task returnedTask = (Task ) result ;
811811
812- // Verify task is completed
812+ // Verify task is completed - poll with retry to handle race condition
813+ // where MainEventBusProcessor may not have finished updating TaskStore yet
814+ // (especially on Java 21 with different thread scheduling)
815+ long pollStart = System .currentTimeMillis ();
816+ long pollTimeoutMs = 1000 ; // 1 second max
817+ while (returnedTask .getStatus ().state () != TaskState .COMPLETED
818+ && (System .currentTimeMillis () - pollStart ) < pollTimeoutMs ) {
819+ try {
820+ Thread .sleep (10 );
821+ // Fetch latest state from TaskStore
822+ returnedTask = taskStore .get (taskId );
823+ } catch (InterruptedException e ) {
824+ Thread .currentThread ().interrupt ();
825+ break ;
826+ }
827+ }
828+
813829 assertEquals (TaskState .COMPLETED , returnedTask .getStatus ().state (),
814830 "Returned task should be COMPLETED" );
815831
You can’t perform that action at this time.
0 commit comments