mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-07-09 17:19:02 +00:00
test(core): wait for cron lock probe takeover (#5535)
This commit is contained in:
parent
8be8ef3e27
commit
8553013ee8
1 changed files with 6 additions and 4 deletions
|
|
@ -1056,14 +1056,16 @@ describe('CronScheduler', () => {
|
|||
vi.useRealTimers();
|
||||
usingFakeTimers = false;
|
||||
|
||||
// The probe acquired the lock and flipped this session to owner.
|
||||
// The probe acquired the lock.
|
||||
await vi.waitFor(async () => {
|
||||
const raw = await fs.readFile(getLockFilePath(tmpDir), 'utf-8');
|
||||
expect(JSON.parse(raw).sessionId).toBe('session-1');
|
||||
});
|
||||
// Now an owner, the durable job fires.
|
||||
scheduler.tick(new Date(2025, 0, 15, 10, 31, 59));
|
||||
expect(fired.map((j) => j.id)).toContain('probe-job');
|
||||
// The lock write can be visible before the probe's .then flips isOwner.
|
||||
await vi.waitFor(() => {
|
||||
scheduler.tick(new Date(2025, 0, 15, 10, 31, 59));
|
||||
expect(fired.map((j) => j.id)).toEqual(['probe-job']);
|
||||
});
|
||||
} finally {
|
||||
if (usingFakeTimers) vi.useRealTimers();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue