Skip to content

Commit 290a0be

Browse files
thymikeeclaude
andcommitted
test(daemon): change the provider leases before the journal retry lands
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 8fd6e2d commit 290a0be

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎packages/daemon/src/server/__tests__/provider-lease-expiry.test.ts‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,13 +266,21 @@ test('a journal write that fails is retried with the latest leases', async () =>
266266
onProviderLeasesChanged: (leases) => daemon.recordLiveLeases(leases),
267267
});
268268
try {
269-
const lease = registry.allocateLease({ tenantId: 't', runId: 'run-1', leaseProvider: 'revyl' });
269+
const first = registry.allocateLease({ tenantId: 't', runId: 'run-1', leaseProvider: 'revyl' });
270+
// A second lease arrives while writes still fail, so the retry must write the latest set.
271+
const second = registry.allocateLease({
272+
tenantId: 't',
273+
runId: 'run-2',
274+
leaseProvider: 'revyl',
275+
});
270276
expect(fs.statSync(journalPath).isDirectory()).toBe(true);
271277

272278
fs.rmdirSync(journalPath);
273279
await vi.advanceTimersByTimeAsync(10);
274280
const journal = JSON.parse(fs.readFileSync(journalPath, 'utf8'));
275-
expect(journal.leases.map((entry: DeviceLease) => entry.leaseId)).toEqual([lease.leaseId]);
281+
expect(journal.leases.map((entry: DeviceLease) => entry.leaseId).sort()).toEqual(
282+
[first.leaseId, second.leaseId].sort(),
283+
);
276284
} finally {
277285
daemon.shutdown();
278286
vi.useRealTimers();

0 commit comments

Comments
 (0)