Remove dry-run and create-only autoscaling modes
This commit is contained in:
@@ -5,16 +5,16 @@ 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: 'dry-run' };
|
||||
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');
|
||||
const scaling = await import('../../src/lib/server/autoscaling/index.js');
|
||||
const { saveServerKey, reserveServerKey } = await import('../../src/lib/server/fleet/server-keys.js');
|
||||
return { db, scaling, saveServerKey, reserveServerKey };
|
||||
}
|
||||
|
||||
it.each(['off', 'dry-run', 'create-only', 'create-destroy'])('saves a %s policy without preallocating keys for its maximum', async mode => {
|
||||
if (mode.startsWith('create')) await prepareNativeHost();
|
||||
it.each(['off', 'create-destroy'])('saves a %s policy without preallocating keys for its maximum', async mode => {
|
||||
const { db, scaling } = await setup();
|
||||
const input = { ...settings, mode, maximum: 20 };
|
||||
const preview = scaling.previewScaling(input);
|
||||
@@ -65,12 +65,11 @@ it('rechecks game pool deletion and reservations after preview', async () => {
|
||||
});
|
||||
|
||||
it('shares capacity between live map policies and admits the job holding the last key', async () => {
|
||||
await prepareNativeHost();
|
||||
const { db, scaling, saveServerKey } = await setup();
|
||||
saveServerKey('t6', 'game-key');
|
||||
saveServerKey('t5', 'other-game-key');
|
||||
for (const mapSlug of ['town', 'farm']) {
|
||||
const input = { ...settings, mapSlug, mode: 'create-only' };
|
||||
const input = { ...settings, mapSlug, mode: 'create-destroy' };
|
||||
scaling.saveScaling(input, undefined, undefined, scaling.previewScaling(input).token);
|
||||
}
|
||||
expect(await scaling.runAutoscaling()).toBe(true);
|
||||
|
||||
Reference in New Issue
Block a user