Skip to content

Commit 4427f50

Browse files
TaskManager tests timings adjustment
1 parent 6c249c1 commit 4427f50

1 file changed

Lines changed: 3 additions & 26 deletions

File tree

src/task/__tests__/TaskManager.test.ts

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ describe("TaskManager", () => {
2727
},
2828
};
2929

30-
await client.metadataResource.registerTaskDef([taskDefinition({
31-
name: "taskmanager-test",
32-
timeoutSeconds: 3600,
33-
})]);
34-
3530
const manager = new TaskManager(client, [worker], {
3631
options: { pollInterval: BASE_TIME },
3732
});
@@ -52,11 +47,7 @@ describe("TaskManager", () => {
5247
input: {},
5348
version: 1,
5449
});
55-
await new Promise((r) => setTimeout(() => r(true), BASE_TIME * 2));
56-
const workflowStatus = await client.workflowResource.getExecutionStatus(
57-
executionId,
58-
true
59-
);
50+
const workflowStatus = await TestUtil.waitForWorkflowCompletion(executor, executionId, BASE_TIME * 2);
6051
await manager.stopPolling();
6152
expect(workflowStatus.status).toEqual("COMPLETED");
6253
});
@@ -74,12 +65,6 @@ describe("TaskManager", () => {
7465
},
7566
};
7667

77-
await client.metadataResource.registerTaskDef([taskDefinition({
78-
name: "taskmanager-error-handler-test-unique",
79-
timeoutSeconds: 3600,
80-
retryCount: 0, // No retries - workflow should fail immediately when task fails
81-
})]);
82-
8368
const manager = new TaskManager(client, [worker], {
8469
options: { pollInterval: BASE_TIME },
8570
onError: mockErrorHandler,
@@ -108,12 +93,10 @@ describe("TaskManager", () => {
10893
"errorHandlerTestIdentifierUnique"
10994
);
11095

111-
await new Promise((r) => setTimeout(() => r(true), BASE_TIME * 2));
112-
11396
await manager.stopPolling();
11497

11598
// Wait for workflow to complete and fail
116-
const workflowStatus = await TestUtil.waitForWorkflowCompletion(executor, status.workflowId!, BASE_TIME * 2);
99+
const workflowStatus = await TestUtil.waitForWorkflowCompletion(executor, status.workflowId!, BASE_TIME * 4);
117100

118101
expect(workflowStatus.status).toEqual("FAILED");
119102
expect(mockErrorHandler).toHaveBeenCalled();
@@ -130,12 +113,6 @@ describe("TaskManager", () => {
130113
},
131114
};
132115

133-
await client.metadataResource.registerTaskDef([taskDefinition({
134-
name: "taskmanager-error-test",
135-
timeoutSeconds: 3600,
136-
retryCount: 0,
137-
})]);
138-
139116
const manager = new TaskManager(client, [worker], {
140117
options: { pollInterval: BASE_TIME },
141118
});
@@ -233,7 +210,7 @@ describe("TaskManager", () => {
233210
// decrease speed again
234211
manager.updatePollingOptions({ pollInterval: BASE_TIME, concurrency: 1 });
235212

236-
const workflowStatus = await TestUtil.waitForWorkflowCompletion(executor, executionId!, BASE_TIME * 2);
213+
const workflowStatus = await TestUtil.waitForWorkflowCompletion(executor, executionId!, BASE_TIME * 5);
237214

238215
expect(workflowStatus.status).toEqual("COMPLETED");
239216
await manager.stopPolling();

0 commit comments

Comments
 (0)