Skip to content

Commit 4d4b08a

Browse files
author
Shailesh Jagannath Padave
committed
Fix test
1 parent e627732 commit 4d4b08a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/core/__test__/executor.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,14 @@ describe("Execute with Return Strategy and Consistency", () => {
145145
// Clean up executions first
146146
for (const executionId of executionsToCleanup) {
147147
try {
148-
await executor.terminate(executionId, "Test cleanup");
148+
const workflowStatus = await executor.getWorkflowStatus(executionId, false, false);
149+
150+
if (workflowStatus.status && !['COMPLETED', 'FAILED', 'TERMINATED', 'TIMED_OUT'].includes(workflowStatus.status)) {
151+
await executor.terminate(executionId, "Test cleanup");
152+
console.debug(`Terminated running workflow: ${executionId}`);
153+
} else {
154+
console.debug(`Skipping cleanup for ${workflowStatus.status} workflow: ${executionId}`);
155+
}
149156
} catch (e) {
150157
console.debug(`Failed to cleanup execution ${executionId}:`, e);
151158
}

0 commit comments

Comments
 (0)