Allow revising active betas with fresh tests and history

This commit is contained in:
2026-10-05 21:02:58 -04:00
parent 9d4ff992a4
commit f8d0ba3936
21 changed files with 713 additions and 41 deletions
+24
View File
@@ -68,6 +68,30 @@ async function tick(seconds = 15, players = 4, healthy = true) {
const scriptPath = (name: string) => join(fixture.t5, name, 'runtime/plutonium/storage/t5/raw/scripts/sp/test.gsc');
describe('durable beta test plans', () => {
it('requires fresh gameplay after a revision and promotes exactly the replacement version', async () => {
const id = await openPlan({ ...defaultPlan(), requirements: [requirement('matches', 'matches')] });
await tick(); await tick();
await postTelemetry(gameEvent('game_start')); await postTelemetry(gameEvent('game_end')); await tick();
const { getBeta, listBetaScripts, reviseBeta, promoteBeta } = await import('../../src/lib/server/fleet/beta.js');
const { testView } = await import('../../src/lib/server/fleet/beta-tests.js');
const { getScript } = await import('../../src/lib/server/fleet/scripts.js');
const file = listBetaScripts(id)[0];
expect(getBeta(id)?.state).toBe('ready-promote');
await reviseBeta(id, 1, [{ scriptId: file.script_id, content: Buffer.from('main() { /* fixed */ }') }]);
const replacement = listBetaScripts(id)[0].script_version_id;
expect(replacement).not.toBe(file.script_version_id);
await postTelemetry(gameEvent('game_end')); // Still running the old revision.
expect(testView(id)?.evidence).toHaveLength(0);
await postTelemetry(gameEvent('heartbeat', 1, 0));
await tick(); await tick();
expect(getBeta(id)?.state).toBe('running');
expect(testView(id)?.servers[0].progress[0].current).toBe(0);
await postTelemetry(gameEvent('game_start')); await postTelemetry(gameEvent('game_end')); await tick();
expect(getBeta(id)?.state).toBe('ready-promote');
await promoteBeta(id);
expect(getScript(file.script_id)?.current_version_id).toBe(replacement);
});
it('waits for occupied telemetry to clear before restarting a beta despite an empty RCON response', async () => {
const id = await openPlan(defaultPlan());
const { listBetaServers } = await import('../../src/lib/server/fleet/beta.js');