Lighten library cache reports and heartbeat cleanup
This commit is contained in:
@@ -68,6 +68,23 @@ function verified(id: string, version: GameLibraryVersion) {
|
||||
}
|
||||
|
||||
describe('automatic host preparation', () => {
|
||||
it('accepts heartbeats without running controller library cleanup', async () => {
|
||||
const host = hosts.createHost({ name: 'Heartbeat host' });
|
||||
const { credential } = hosts.enrollHost(hosts.createEnrollment(host.id).token, inventory);
|
||||
const { POST } = await import('../../src/routes/api/agent/heartbeat/+server.js');
|
||||
const cleanup = vi.spyOn(libraries, 'cleanupControllerLibraries').mockRejectedValue(new Error('Cleanup is independent of heartbeats'));
|
||||
try {
|
||||
for (let i = 0; i < 3; i++) {
|
||||
const response = await POST({ request: new Request('https://controller.test/api/agent/heartbeat', {
|
||||
method: 'POST', headers: { Authorization: `Bearer ${credential}`, 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ inventory: { ...inventory, libraryCaches: [] } })
|
||||
}) });
|
||||
expect(response.status).toBe(200);
|
||||
}
|
||||
expect(cleanup).not.toHaveBeenCalled();
|
||||
} finally { cleanup.mockRestore(); }
|
||||
});
|
||||
|
||||
it('keeps re-enabled hosts disabled until a fresh runtime pull and both game libraries are verified', async () => {
|
||||
const t5 = await publish('t5');
|
||||
const t6 = await publish('t6');
|
||||
|
||||
Reference in New Issue
Block a user