Skip to content

Commit 445976e

Browse files
authored
perf: speed up Docker scheduler tests (#99988)
1 parent 11eeba9 commit 445976e

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

test/scripts/docker-all-scheduler.test.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,8 @@ postgres Created
519519
)}`,
520520
env: process.env,
521521
label: "oversized-capture-timeout",
522-
timeoutKillGraceMs: Number.MAX_SAFE_INTEGER,
523-
timeoutMs: Number.MAX_SAFE_INTEGER,
522+
timeoutKillGraceMs: Number.MAX_SAFE_INTEGER,
523+
timeoutMs: Number.MAX_SAFE_INTEGER,
524524
});
525525

526526
expect(result).toMatchObject({
@@ -608,7 +608,7 @@ setInterval(() => {}, 1000);
608608
command: `exec ${JSON.stringify(process.execPath)} ${JSON.stringify(scriptPath)}`,
609609
env: process.env,
610610
label: "oversized-timeout-grace",
611-
timeoutKillGraceMs: Number.MAX_SAFE_INTEGER,
611+
timeoutKillGraceMs: Number.MAX_SAFE_INTEGER,
612612
timeoutMs: 500,
613613
});
614614

@@ -730,12 +730,17 @@ setInterval(() => {}, 1000);
730730
`,
731731
"utf8",
732732
);
733+
// Preserve the production 10s grace while accelerating only this spawned proof's clock.
733734
writeFileSync(
734735
runnerPath,
735736
`
736-
import { runShellCommand } from ${JSON.stringify(
737+
const realNow = Date.now.bind(Date);
738+
const startedAt = realNow();
739+
Date.now = () => startedAt + (realNow() - startedAt) * 100;
740+
741+
const { runShellCommand } = await import(${JSON.stringify(
737742
new URL("../../scripts/test-docker-all.mjs", import.meta.url).href,
738-
)};
743+
)});
739744
740745
await runShellCommand({
741746
command: ${JSON.stringify(`exec ${JSON.stringify(process.execPath)} ${JSON.stringify(leaderPath)}`)},

0 commit comments

Comments
 (0)