@@ -10,7 +10,7 @@ const BASE_TIME = 500;
1010describe ( "TaskManager" , ( ) => {
1111 const clientPromise = orkesConductorClient ( { useEnvVars : true , refreshTokenInterval : 0 } ) ;
1212
13- jest . setTimeout ( 15000 ) ;
13+ jest . setTimeout ( 10000 ) ;
1414 test ( "Should run workflow with worker" , async ( ) => {
1515 const client = await clientPromise ;
1616 const executor = new WorkflowExecutor ( client ) ;
@@ -52,7 +52,7 @@ describe("TaskManager", () => {
5252 input : { } ,
5353 version : 1 ,
5454 } ) ;
55- await new Promise ( ( r ) => setTimeout ( ( ) => r ( true ) , BASE_TIME * 3 ) ) ;
55+ await new Promise ( ( r ) => setTimeout ( ( ) => r ( true ) , BASE_TIME * 2 ) ) ;
5656 const workflowStatus = await client . workflowResource . getExecutionStatus (
5757 executionId ,
5858 true
@@ -98,7 +98,7 @@ describe("TaskManager", () => {
9898 "errorHandlerTestIdentifierUnique"
9999 ) ;
100100
101- await new Promise ( ( r ) => setTimeout ( ( ) => r ( true ) , BASE_TIME * 3 ) ) ;
101+ await new Promise ( ( r ) => setTimeout ( ( ) => r ( true ) , BASE_TIME * 2 ) ) ;
102102
103103 await manager . stopPolling ( ) ;
104104
@@ -120,6 +120,7 @@ describe("TaskManager", () => {
120120 await client . metadataResource . registerTaskDef ( [ taskDefinition ( {
121121 name : "taskmanager-error-test" ,
122122 timeoutSeconds : 3600 ,
123+ retryCount : 0 ,
123124 } ) ] ) ;
124125
125126 const manager = new TaskManager ( client , [ worker ] , {
@@ -138,7 +139,7 @@ describe("TaskManager", () => {
138139 timeoutSeconds : 0 ,
139140 } ) ;
140141
141- const status = await executor . executeWorkflow (
142+ const { workflowId : executionId } = await executor . executeWorkflow (
142143 {
143144 name : "TaskManagerTestE" ,
144145 input : { } ,
@@ -148,8 +149,14 @@ describe("TaskManager", () => {
148149 1 ,
149150 "noErrorHandlerProvidedIdentifier"
150151 ) ;
152+
151153 await manager . stopPolling ( ) ;
152- expect ( status . status ) . toEqual ( "FAILED" ) ;
154+
155+ // Wait for workflow to complete and fail
156+ const workflowStatus = await TestUtil . waitForWorkflowCompletion ( executor , executionId ! , BASE_TIME * 2 ) ;
157+ expect ( workflowStatus . status ) . toEqual ( "FAILED" ) ;
158+
159+
153160 } ) ;
154161
155162 test ( "multi worker example" , async ( ) => {
@@ -215,7 +222,7 @@ describe("TaskManager", () => {
215222 // decrease speed again
216223 manager . updatePollingOptions ( { pollInterval : BASE_TIME , concurrency : 1 } ) ;
217224
218- const workflowStatus = await TestUtil . waitForWorkflowCompletion ( executor , executionId ! , 30000 ) ;
225+ const workflowStatus = await TestUtil . waitForWorkflowCompletion ( executor , executionId ! , BASE_TIME * 2 ) ;
219226
220227 expect ( workflowStatus . status ) . toEqual ( "COMPLETED" ) ;
221228 await manager . stopPolling ( ) ;
0 commit comments