diff --git a/packages/services/service-knowledge/src/__tests__/sync-state.test.ts b/packages/services/service-knowledge/src/__tests__/sync-state.test.ts index a2778da3b10..1623c8aa835 100644 --- a/packages/services/service-knowledge/src/__tests__/sync-state.test.ts +++ b/packages/services/service-knowledge/src/__tests__/sync-state.test.ts @@ -317,6 +317,7 @@ async function seedArticles(n: Node): Promise { } describe('one record per source, the same on every node', () => { + // Four kernel boots over one file, three seeded syncs, two rebuilds: 1.28 s worst measured under doubled suite load, x20 headroom. 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 () => { const file = freshFile(); const store = makeStore(); @@ -375,8 +376,9 @@ describe('one record per source, the same on every node', () => { expect((await a2.status()).build).toEqual(current); expect((await b2.status()).build).toEqual(current); expect(await a2.stateRows()).toHaveLength(1); - }); + }, 26_000); + // 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. it('a build whose node stopped mid-walk reads running until the next boot, then interrupted', async () => { const file = freshFile(); const store = makeStore(); @@ -392,8 +394,9 @@ describe('one record per source, the same on every node', () => { expect(after.build).toMatchObject({ status: 'interrupted', trigger: 'operator' }); expect(after.build?.finishedAt).toBeDefined(); expect(after.build?.message).toContain('stopped before it ended'); - }); + }, 16_000); + // Three kernel boots over one file, three seeded syncs, a rebuild: 0.81 s worst measured under doubled suite load, x20 headroom. 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 () => { const file = freshFile(); const store = makeStore(); @@ -414,8 +417,9 @@ describe('one record per source, the same on every node', () => { expect((await c.status()).build).toMatchObject({ status: 'interrupted', startedAt }); expect((await b.status()).build).toMatchObject({ status: 'interrupted', startedAt }); expect(cluster.held.size).toBe(0); - }); + }, 17_000); + // Two kernel boots over one file, three seeded syncs, three rebuild calls: 0.46 s worst measured under doubled suite load, x20 headroom. it('the next lease holder closes the build a stopped node left running before it starts its own', async () => { const file = freshFile(); const store = makeStore(); @@ -447,7 +451,7 @@ describe('one record per source, the same on every node', () => { expect((await a.status()).build).toMatchObject({ status: 'running', startedAt: takenAt }); release(); await vi.waitFor(async () => expect((await a.status()).build?.status).toBe('done'), { timeout: 5000, interval: 20 }); - }); + }, 10_000); }); describe('sync failures: one per dead letter, cleared by the reconcile that repairs them', () => {