Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(lanes): pin the clock before the background writer defers

garrytanf3daeed158ac
diff --git a/test/managed-sync-lanes.test.ts b/test/managed-sync-lanes.test.ts
index 6384c37dd8..39df3026f1 100644
--- a/test/managed-sync-lanes.test.ts
+++ b/test/managed-sync-lanes.test.ts
@@ -121,7 +121,9 @@ test('a lease is shared by lanes; an exclusive writer drains and wounds it and g
test('a background writer never wounds the lanes: the lease drains for it after the defer wait, and no new lease starts until it has the lock', async () => {
const native = (): Promise<NativeLockHandle> => { let done = false; return Promise.resolve({ get released() { return done; }, async release() { done = true; } }); };
const path = join(home, 'lease-defer');
+ // The clock is pinned before the writer defers, so the defer wait is measured from a known instant.
const start = Date.now();
+ setSystemTime(new Date(start));
try {
const lane = (await acquireShared(path, native))!;
expect(deferToLease(path)).toBe(false);