Skip to content

Commit ccd3000

Browse files
committed
Another attempt to fix the flaky test
1 parent b4d0db3 commit ccd3000

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

internal-packages/run-engine/src/engine/tests/heartbeats.test.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ describe("RunEngine heartbeats", () => {
639639
containerTest("Heartbeat keeps run alive", async ({ prisma, redisOptions }) => {
640640
const authenticatedEnvironment = await setupAuthenticatedEnvironment(prisma, "PRODUCTION");
641641

642-
const executingTimeout = 100;
642+
const executingTimeout = 500;
643643

644644
const engine = new RunEngine({
645645
prisma,
@@ -706,7 +706,7 @@ describe("RunEngine heartbeats", () => {
706706
prisma
707707
);
708708

709-
await setTimeout(1000);
709+
await setTimeout(500);
710710

711711
//dequeue the run
712712
const dequeued = await engine.dequeueFromWorkerQueue({
@@ -726,24 +726,23 @@ describe("RunEngine heartbeats", () => {
726726
expect(executionData.snapshot.executionStatus).toBe("EXECUTING");
727727
expect(executionData.run.status).toBe("EXECUTING");
728728

729-
// Send heartbeats every 50ms (half the timeout)
730-
for (let i = 0; i < 6; i++) {
731-
await setTimeout(50);
729+
// Send heartbeats every 100ms (to make sure we're not timing out)
730+
for (let i = 0; i < 5; i++) {
731+
await setTimeout(100);
732732
await engine.heartbeatRun({
733733
runId: run.id,
734734
snapshotId: attempt.snapshot.id,
735735
});
736736
}
737737

738-
// After 300ms (3x the timeout) the run should still be executing
739-
// because we've been sending heartbeats
738+
// Should still be executing because we're sending heartbeats
740739
const executionData2 = await engine.getRunExecutionData({ runId: run.id });
741740
assertNonNullable(executionData2);
742741
expect(executionData2.snapshot.executionStatus).toBe("EXECUTING");
743742
expect(executionData2.run.status).toBe("EXECUTING");
744743

745744
// Stop sending heartbeats and wait for timeout
746-
await setTimeout(executingTimeout * 3);
745+
await setTimeout(executingTimeout * 2);
747746

748747
// Now it should have timed out and be queued
749748
const executionData3 = await engine.getRunExecutionData({ runId: run.id });

0 commit comments

Comments
 (0)