Skip to content

Commit b77c959

Browse files
fix TaskManager tests
1 parent e0979cb commit b77c959

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

src/task/__tests__/TaskManager.test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { simpleTask, WorkflowExecutor, taskDefinition } from "../../core";
33
import { orkesConductorClient } from "../../orkes";
44
import { TaskManager, ConductorWorker } from "../index";
55
import { mockLogger } from "./mockLogger";
6-
import {TestUtil} from "../../core/__test__/utils/test-util";
6+
import { TestUtil } from "../../core/__test__/utils/test-util";
77

88

99
const BASE_TIME = 500;
@@ -102,7 +102,10 @@ describe("TaskManager", () => {
102102

103103
await manager.stopPolling();
104104

105-
expect(status.status).toEqual("FAILED");
105+
// Wait for workflow to complete and fail
106+
const workflowStatus = await TestUtil.waitForWorkflowCompletion(executor, status.workflowId!, BASE_TIME * 2);
107+
108+
expect(workflowStatus.status).toEqual("FAILED");
106109
expect(mockErrorHandler).toHaveBeenCalled();
107110
});
108111

@@ -151,12 +154,10 @@ describe("TaskManager", () => {
151154
);
152155

153156
await manager.stopPolling();
154-
157+
155158
// Wait for workflow to complete and fail
156159
const workflowStatus = await TestUtil.waitForWorkflowCompletion(executor, executionId!, BASE_TIME * 2);
157160
expect(workflowStatus.status).toEqual("FAILED");
158-
159-
160161
});
161162

162163
test("multi worker example", async () => {
@@ -361,7 +362,7 @@ describe("TaskManager", () => {
361362
expect(mockLogger.info).toBeCalledWith(
362363
`TaskWorker ${candidateWorkerUpdate} initialized with concurrency of ${initialCandidateWorkflowOptions.concurrency} and poll interval of ${initialCandidateWorkflowOptions.pollInterval}`
363364
);
364-
365+
365366

366367
expect(mockLogger.info).toBeCalledWith(
367368
`TaskWorker ${candidateWorkerUpdate} configuration updated with concurrency of ${updatedWorkerOptions.concurrency} and poll interval of ${updatedWorkerOptions.pollInterval}`

0 commit comments

Comments
 (0)