Wait for round two before adding spare lobbies
CI / checks (push) Successful in 7m20s

This commit is contained in:
2026-10-15 20:40:03 -04:00
parent 68616327ec
commit c1758cce25
11 changed files with 298 additions and 7 deletions
+9 -1
View File
@@ -1,6 +1,7 @@
import { afterEach, beforeEach, expect, it, vi } from 'vitest';
import { newFixture, type Fixture } from '../helpers/fixture.js';
import { prepareNativeHost } from '../helpers/native-host.js';
import { gameEvent } from '../helpers/telemetry.js';
import { zombieMaps } from '../../src/lib/map-aliases.js';
let fixture: Fixture;
@@ -137,8 +138,15 @@ it.each([
pausedReason: null
});
// Once recovered, actual occupancy can request a new spare normally.
// Recovery and occupancy alone cannot request a spare before round two.
db().prepare('UPDATE servers SET last_players=1 WHERE name=?').run(server);
expect(await scaling.runAutoscaling()).toBe(false);
vi.setSystemTime(Date.now() + 1_000);
const { saveTelemetry } = await import('../../src/lib/server/fleet/telemetry.js');
saveTelemetry({
...gameEvent('heartbeat', 2, 1, server, 'zm_transit'),
receivedAt: new Date().toISOString()
});
expect(await scaling.runAutoscaling()).toBe(true);
expect(
db().prepare("SELECT server FROM server_deployments WHERE action='create'").all()