Remove dry-run and create-only autoscaling modes

This commit is contained in:
2026-10-07 15:49:46 -04:00
parent c9a604303d
commit eadf97a428
18 changed files with 172 additions and 105 deletions
+5 -2
View File
@@ -5,7 +5,7 @@ import { prepareNativeHost } from '../helpers/native-host.js';
let fixture: Fixture;
beforeEach(async () => { vi.resetModules(); fixture = await newFixture([]); });
afterEach(async () => { await fixture.cleanup(); });
const settings = { game: 't6', mapSlug: 'town', maximum: 2, mode: 'create-only' };
const settings = { game: 't6', mapSlug: 'town', maximum: 2, mode: 'create-destroy' };
async function setup() {
await prepareNativeHost();
const { db } = await import('../../src/lib/server/db/index.js');
@@ -77,8 +77,11 @@ it('operator cancellation pauses the policy and does not immediately create a re
it('exact matching cannot remove an owned map absent from the collection', async () => {
const town = 't6_zombie_town_1';
await prepareNativeHost([town]);
const { host } = await prepareNativeHost([town]);
const { db } = await import('../../src/lib/server/db/index.js');
const { autoscalingRemovalCapability } = await import('../../src/lib/server/autoscaling/authorization.js');
db().prepare("UPDATE ec_hosts SET inventory=json_set(inventory,'$.capabilities',json(?)) WHERE id=?")
.run(JSON.stringify([autoscalingRemovalCapability]), host.id);
const at = new Date().toISOString();
db().prepare("INSERT INTO servers(name,game,map,map_slug,container_state,container_checked_at,last_seen_at,last_players) VALUES(?,'t6','zm_transit','town','running',?,?,0)").run(town, at, at);
for (const n of [1, 2]) db().prepare("INSERT INTO server_keys(id,game,pluto_key) VALUES(?,'t6',?)").run(`key-${n}`, `key-${n}`);