Supplement telemetry rosters with fresh RCON pings
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { newFixture, type Fixture } from '../helpers/fixture.js';
|
||||
import { gameEvent, postTelemetry } from '../helpers/telemetry.js';
|
||||
|
||||
let fixture: Fixture;
|
||||
let at: number;
|
||||
@@ -45,6 +46,19 @@ async function setup(count = 5, hostCount = 1) {
|
||||
}
|
||||
|
||||
describe('host status observations', () => {
|
||||
it('batches occupied telemetry lobbies for pings while skipping empty lobbies', async () => {
|
||||
const api = await setup(2);
|
||||
await postTelemetry(gameEvent('heartbeat', 15, 1, 'server-0-0'));
|
||||
await postTelemetry(gameEvent('heartbeat', 15, 0, 'server-0-1'));
|
||||
const pass = api.fanoutStatus();
|
||||
try {
|
||||
await vi.waitFor(() => expect(api.operations()).toHaveLength(1));
|
||||
expect(api.operations()[0]).toMatchObject({ kind: 'rcon.status-batch',
|
||||
payload: { instances: [{ instanceId: 'instance-0-0', generation: 1 }] } });
|
||||
} finally { api.complete(); await pass; }
|
||||
expect(api.getServer('server-0-1')?.last_seen_at).toBeNull();
|
||||
});
|
||||
|
||||
it('bounds monitoring reads below five per server across thirty instances', async () => {
|
||||
const api = await setup(10, 3);
|
||||
const hosts = await import('../../src/lib/server/hosts/index.js');
|
||||
|
||||
Reference in New Issue
Block a user