Use status monitor evidence for routine watchdog health checks
This commit is contained in:
@@ -59,6 +59,10 @@ describe('host status observations', () => {
|
||||
} finally { api.complete(); await Promise.all(passes); }
|
||||
expect(api.inspect).not.toHaveBeenCalled();
|
||||
expect(api.getServer('server-2-4')).toMatchObject({ last_players: 0, last_map: 'mp_kino', container_checked_at: new Date(at).toISOString() });
|
||||
expect(api.monitoringStatus('server-2-4')).toMatchObject({
|
||||
container: { observedAt: new Date(at).toISOString(), result: { ok: true } },
|
||||
game: { observedAt: api.getServer('server-2-4')?.last_seen_at, result: { ok: true } }
|
||||
});
|
||||
expect(api.db.prepare('SELECT COUNT(*) AS n FROM metric_samples').get()).toEqual({ n: 15 });
|
||||
await api.fanoutStatus();
|
||||
expect(api.operations()).toHaveLength(3);
|
||||
@@ -90,6 +94,9 @@ describe('host status observations', () => {
|
||||
api.heartbeat(host.id, { ...host.inventory, instanceStates: [{ ...host.inventory.instanceStates![0], healthy: false, state: 'exited' }] });
|
||||
await api.fanoutStatus();
|
||||
expect(api.getServer('server-0-0')?.container_state).toBe('exited');
|
||||
expect(api.monitoringStatus('server-0-0')).toMatchObject({ container: {
|
||||
observedAt: new Date(at).toISOString(), result: { ok: false, state: 'exited' }
|
||||
} });
|
||||
expect(api.operations()).toEqual([]);
|
||||
});
|
||||
|
||||
@@ -120,6 +127,7 @@ describe('host status observations', () => {
|
||||
} finally { api.complete(); await pass; }
|
||||
expect(api.getServer('server-0-0')?.last_error).toBe('bad-reply:wrong RCON password');
|
||||
expect(api.getServer('server-0-4')?.last_error).toContain('timeout:');
|
||||
expect(api.monitoringStatus('server-0-4')?.game?.result).toMatchObject({ ok: false, reason: 'timeout' });
|
||||
expect(api.operations()).toHaveLength(1);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user