Skip to content

Commit 6df5846

Browse files
committed
feat: adjust timeouts for database locking tests based on CI platform speed
1 parent 6b4f240 commit 6df5846

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/multi-process.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,10 @@ describe("Multi-Process Database Access", () => {
334334

335335
describe("File Locking and Error Handling", () => {
336336
test("handles database locked errors gracefully", async () => {
337+
// Use longer timeouts on slower CI platforms
338+
const isSlowCI = process.platform === 'darwin' || process.platform === 'win32';
339+
const lockHoldTime = isSlowCI ? 5000 : 1000;
340+
const writerDelay = isSlowCI ? 2000 : 200;
337341
const setupDb = new DatabaseSync(dbPath);
338342
setupDb.exec(`
339343
CREATE TABLE lock_test (
@@ -359,7 +363,7 @@ describe("Multi-Process Database Access", () => {
359363
db.exec("COMMIT");
360364
db.close();
361365
console.log("LOCK_RELEASED");
362-
}, 1000); // Increased lock time for CI reliability
366+
}, ${lockHoldTime}); // Platform-specific lock time
363367
`;
364368

365369
// Script that tries to write while locked
@@ -381,7 +385,7 @@ describe("Multi-Process Database Access", () => {
381385
} finally {
382386
db.close();
383387
}
384-
}, 200); // Increased delay for CI reliability
388+
}, ${writerDelay}); // Platform-specific delay
385389
`;
386390

387391
// Start lock holder process

0 commit comments

Comments
 (0)