File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55namespace Tests \Feature ;
66
7+ use RuntimeException ;
78use Tests \Fixtures \TestTimeoutWorkflow ;
89use Tests \TestCase ;
10+ use Workflow \States \WorkflowFailedStatus ;
911use Workflow \WorkflowStub ;
1012
1113final class TimeoutWorkflowTest extends TestCase
@@ -16,8 +18,27 @@ public function testTimeout(): void
1618
1719 $ workflow ->start ();
1820
19- while ($ workflow ->running ());
21+ $ deadline = now ()
22+ ->addSeconds (20 );
2023
24+ while ($ workflow ->running () && now ()->lt ($ deadline )) {
25+ usleep (50000 );
26+ $ workflow ->fresh ();
27+ }
28+
29+ if ($ workflow ->running ()) {
30+ throw new RuntimeException (sprintf (
31+ 'Timed out waiting for activity timeout workflow %s to fail. Current status: %s; exceptions: %d; logs: %d ' ,
32+ (string ) $ workflow ->id (),
33+ (string ) $ workflow ->status (),
34+ $ workflow ->exceptions ()
35+ ->count (),
36+ $ workflow ->logs ()
37+ ->count (),
38+ ));
39+ }
40+
41+ $ this ->assertSame (WorkflowFailedStatus::class, $ workflow ->status ());
2142 $ this ->assertSame (1 , $ workflow ->exceptions ()->count ());
2243 }
2344}
You can’t perform that action at this time.
0 commit comments