Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/integration-tests/LeaseExtension.validation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ import { cleanupWorkflowsAndTasks } from "./utils/cleanup";
// ─── Timing constants ────────────────────────────────────────────────────────
const RESPONSE_TIMEOUT_SECONDS = 10; // responseTimeoutSeconds on task def
const TASK_EXECUTION_MS = 20_000; // worker "works" for 20s (> 10s timeout)
// Long-poll window. The task is polled immediately after startWorkflow, so
// this has to cover the server's queueing latency, not just the network hop.
const POLL_WAIT_MS = 5_000;
// Heartbeat fires at 10 * 0.8 = 8s — before the 10s deadline

describe("Lease Extension — end-to-end validation", () => {
Expand Down Expand Up @@ -127,7 +130,7 @@ describe("Lease Extension — end-to-end validation", () => {
console.log(`\n▶ Workflow 1 id=${workflowId1} (no heartbeat)`);

// Poll the task directly so we control execution
const { data: tasks1 } = await TaskResource.batchPoll({ client, path: { tasktype: taskDefName }, query: { workerid: "val-worker-no-lease", count: 1, timeout: 200 } });
const { data: tasks1 } = await TaskResource.batchPoll({ client, path: { tasktype: taskDefName }, query: { workerid: "val-worker-no-lease", count: 1, timeout: POLL_WAIT_MS } });
const [task] = tasks1 ?? [];
expect(task).toBeDefined();
const taskId1 = task.taskId ?? "";
Expand Down Expand Up @@ -172,7 +175,7 @@ describe("Lease Extension — end-to-end validation", () => {
const workflowId2 = await executor.startWorkflowByName(wfName, {}, 1);
console.log(`\n▶ Workflow 2 id=${workflowId2} (with heartbeat)`);

const { data: tasks2 } = await TaskResource.batchPoll({ client, path: { tasktype: taskDefName }, query: { workerid: "val-worker-with-lease", count: 1, timeout: 200 } });
const { data: tasks2 } = await TaskResource.batchPoll({ client, path: { tasktype: taskDefName }, query: { workerid: "val-worker-with-lease", count: 1, timeout: POLL_WAIT_MS } });
const [task] = tasks2 ?? [];
expect(task).toBeDefined();
const taskId2 = task.taskId ?? "";
Expand Down
14 changes: 9 additions & 5 deletions src/integration-tests/TaskManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ import { waitForWorkflowCompletion } from "./utils/waitForWorkflowCompletion";
import { describeForOrkesV5 } from "./utils/customJestDescribe";

const BASE_TIME = 1000;
// Every other integration test takes waitForWorkflowCompletion's 5-minute
// default. These four wait on a worker to poll for and finish each task, so
// they need enough room for a slow or contended server; 30s was losing races.
const WF_WAIT_MS = BASE_TIME * 90;
describe("TaskManager", () => {
const clientPromise = createClientWithRetry();
const workflowsToCleanup: { name: string; version: number }[] = [];
const tasksToCleanup: string[] = [];
const activeManagers: TaskManager[] = [];

jest.setTimeout(60000);
jest.setTimeout(120000);

afterEach(async () => {
for (const m of activeManagers) {
Expand Down Expand Up @@ -136,7 +140,7 @@ describe("TaskManager", () => {
const workflowStatus = await waitForWorkflowCompletion(
executor,
executionId,
BASE_TIME * 30
WF_WAIT_MS
);

expect(workflowStatus.status).toEqual("COMPLETED");
Expand Down Expand Up @@ -211,7 +215,7 @@ describe("TaskManager", () => {
const workflowStatus = await waitForWorkflowCompletion(
executor,
status,
BASE_TIME * 30
WF_WAIT_MS
);

expect(workflowStatus.status).toEqual("FAILED");
Expand Down Expand Up @@ -283,7 +287,7 @@ describe("TaskManager", () => {
const workflowStatus = await waitForWorkflowCompletion(
executor,
executionId,
BASE_TIME * 30
WF_WAIT_MS
);
expect(workflowStatus.status).toEqual("FAILED");
await manager.stopPolling();
Expand Down Expand Up @@ -358,7 +362,7 @@ describe("TaskManager", () => {
const workflowStatus = await waitForWorkflowCompletion(
executor,
executionId,
BASE_TIME * 30
WF_WAIT_MS
);

expect(workflowStatus.status).toEqual("COMPLETED");
Expand Down
4 changes: 3 additions & 1 deletion src/integration-tests/WorkflowExecutor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,9 @@ describe("WorkflowExecutor", () => {

// Register all test workflows
await registerAllWorkflows();
}, 30000);
// No explicit hook timeout: inherit the describe's 300s. Registering
// several workflow definitions against a slow server outran 30s.
});

afterEach(async () => {
// Clean up executions first
Expand Down
Loading