Reconcile host preparation on heartbeats instead of polls

This commit is contained in:
2026-10-06 14:52:03 -04:00
parent d99e5979fa
commit b17673720b
4 changed files with 12 additions and 6 deletions
+8
View File
@@ -183,6 +183,14 @@ describe('automatic host preparation', () => {
});
expect(operations(host.id)).toEqual([]);
// Poll lanes only deliver queued work. One inventory heartbeat drives setup.
const reconcile = vi.spyOn(preparation, 'reconcileHostPreparation');
expect((await (await pollOperations({ request: request('operations') })).json()).operations).toEqual([]);
expect(reconcile).not.toHaveBeenCalled();
expect((await reportHeartbeat({ request: request('heartbeat', { inventory }) })).status).toBe(200);
expect(reconcile).toHaveBeenCalledOnce();
reconcile.mockRestore();
const firstPoll = await (await pollOperations({ request: request('operations') })).json();
expect(firstPoll.operations).toHaveLength(1);
const runtimeOperation = firstPoll.operations[0];