File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
impl/test/src/test/java/io/serverlessworkflow/impl/test Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 1717
1818import static io .serverlessworkflow .api .WorkflowReader .readWorkflowFromClasspath ;
1919import static org .assertj .core .api .Assertions .assertThat ;
20+ import static org .awaitility .Awaitility .await ;
2021
2122import io .serverlessworkflow .api .types .Workflow ;
2223import io .serverlessworkflow .impl .WorkflowApplication ;
2324import io .serverlessworkflow .impl .WorkflowInstance ;
2425import io .serverlessworkflow .impl .WorkflowModel ;
2526import io .serverlessworkflow .impl .WorkflowStatus ;
2627import java .io .IOException ;
28+ import java .time .Duration ;
2729import java .util .Collection ;
2830import java .util .List ;
2931import java .util .Map ;
@@ -61,11 +63,12 @@ void testForkWaitWithSuspend() throws IOException, InterruptedException {
6163 Workflow workflow = readWorkflowFromClasspath ("workflows-samples/fork-wait.yaml" );
6264 WorkflowInstance instance = appl .workflowDefinition (workflow ).instance (Map .of ());
6365 CompletableFuture <WorkflowModel > future = instance .start ();
64- Thread .sleep (50 );
65- assertThat (instance .status ()).isEqualTo (WorkflowStatus .WAITING );
66+ await ()
67+ .pollDelay (Duration .ofMillis (5 ))
68+ .atMost (Duration .ofMillis (100 ))
69+ .until (() -> instance .status () == WorkflowStatus .WAITING );
6670 instance .suspend ();
6771 assertThat (instance .status ()).isEqualTo (WorkflowStatus .SUSPENDED );
68- Thread .sleep (200 );
6972 instance .resume ();
7073 WorkflowModel model = future .join ();
7174 assertThat (instance .status ()).isEqualTo (WorkflowStatus .COMPLETED );
You can’t perform that action at this time.
0 commit comments