Skip to content

Commit 99a5eca

Browse files
committed
test(gateway-lock): assert hashed lock path in writeFile failure test
The test previously hardcoded lockPath as gateway.lock, but the actual lock path uses SHA256 hash. Use resolveLockPath(env).lockPath so the cleanup assertion matches the real acquireGatewayLock behavior.
1 parent 366a50c commit 99a5eca

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/infra/gateway-lock.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,11 @@ describe("gateway lock", () => {
377377
openSpy.mockRestore();
378378
});
379379

380-
it("closes handle and removes partial lock on writeFile failure after open", async () => {
380+
it("closes handle and removes lock file on writeFile rejection after open", async () => {
381381
vi.useRealTimers();
382382
const env = await makeEnv();
383-
const lockPath = path.join(resolveTestLockDir(), "gateway.lock");
383+
const { lockPath } = resolveLockPath(env);
384+
await fs.mkdir(path.dirname(lockPath), { recursive: true });
384385

385386
let closeCalled = false;
386387
const fakeHandle = {
@@ -394,7 +395,6 @@ describe("gateway lock", () => {
394395

395396
await expect(acquireForTest(env)).rejects.toThrow("failed to acquire gateway lock");
396397
expect(closeCalled).toBe(true);
397-
// Partial lock file cleaned up — should not exist on disk.
398398
await expect(fs.access(lockPath)).rejects.toThrow();
399399

400400
openSpy.mockRestore();

0 commit comments

Comments
 (0)