Skip to content

Commit 77e6bad

Browse files
committed
test(service-knowledge): give the multi-node sync-state cases measured timeouts
The rebuild-through-node-A case boots four kernels over one file, seeds three records, runs two rebuilds and restarts both nodes inside vitest's default 5000 ms; under the merge queue's full-suite load it timed out. Each multi-node case in the file now carries an explicit budget of 20x its worst locally measured duration under doubled suite load. No case is skipped and no assertion or waitFor changes. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
1 parent bc31d45 commit 77e6bad

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎packages/services/service-knowledge/src/__tests__/sync-state.test.ts‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ async function seedArticles(n: Node): Promise<Row[]> {
317317
}
318318

319319
describe('one record per source, the same on every node', () => {
320+
// Four kernel boots over one file, three seeded syncs, two rebuilds: 1.28 s worst measured under doubled suite load, x20 headroom.
320321
it('a rebuild through node A reads identically on node B while it runs and after it ends — an index already current included — and after both restart', async () => {
321322
const file = freshFile();
322323
const store = makeStore();
@@ -375,8 +376,9 @@ describe('one record per source, the same on every node', () => {
375376
expect((await a2.status()).build).toEqual(current);
376377
expect((await b2.status()).build).toEqual(current);
377378
expect(await a2.stateRows()).toHaveLength(1);
378-
});
379+
}, 26_000);
379380

381+
// Two kernel boots over one file, three seeded syncs, a rebuild and a restart: 0.77 s worst measured under doubled suite load, x20 headroom.
380382
it('a build whose node stopped mid-walk reads running until the next boot, then interrupted', async () => {
381383
const file = freshFile();
382384
const store = makeStore();
@@ -392,8 +394,9 @@ describe('one record per source, the same on every node', () => {
392394
expect(after.build).toMatchObject({ status: 'interrupted', trigger: 'operator' });
393395
expect(after.build?.finishedAt).toBeDefined();
394396
expect(after.build?.message).toContain('stopped before it ended');
395-
});
397+
}, 16_000);
396398

399+
// Three kernel boots over one file, three seeded syncs, a rebuild: 0.81 s worst measured under doubled suite load, x20 headroom.
397400
it("over a cluster lock: a boot leaves a build whose lease another node holds; once its lease runs out the next boot or the next lease holder closes it interrupted", async () => {
398401
const file = freshFile();
399402
const store = makeStore();
@@ -414,8 +417,9 @@ describe('one record per source, the same on every node', () => {
414417
expect((await c.status()).build).toMatchObject({ status: 'interrupted', startedAt });
415418
expect((await b.status()).build).toMatchObject({ status: 'interrupted', startedAt });
416419
expect(cluster.held.size).toBe(0);
417-
});
420+
}, 17_000);
418421

422+
// Two kernel boots over one file, three seeded syncs, three rebuild calls: 0.46 s worst measured under doubled suite load, x20 headroom.
419423
it('the next lease holder closes the build a stopped node left running before it starts its own', async () => {
420424
const file = freshFile();
421425
const store = makeStore();
@@ -447,7 +451,7 @@ describe('one record per source, the same on every node', () => {
447451
expect((await a.status()).build).toMatchObject({ status: 'running', startedAt: takenAt });
448452
release();
449453
await vi.waitFor(async () => expect((await a.status()).build?.status).toBe('done'), { timeout: 5000, interval: 20 });
450-
});
454+
}, 10_000);
451455
});
452456

453457
describe('sync failures: one per dead letter, cleared by the reconcile that repairs them', () => {

0 commit comments

Comments
 (0)