Pool Plutonium keys by game for launches and autoscaling
This commit is contained in:
@@ -10,7 +10,7 @@ async function setup(mode = 'dry-run') {
|
||||
if (mode.startsWith('create')) await prepareNativeHost();
|
||||
const { db } = await import('../../src/lib/server/db/index.js');
|
||||
const scaling = await import('../../src/lib/server/autoscaling/index.js');
|
||||
db().prepare('INSERT INTO server_keys(server_id,pluto_key) VALUES(?,?)').run('t6_zombie_town_1', 'test-key');
|
||||
db().prepare("INSERT INTO server_keys(id,game,pluto_key) VALUES('key-1','t6','test-key')").run();
|
||||
const input = { ...settings, mode };
|
||||
const saved = scaling.saveScaling(input, undefined, undefined, scaling.previewScaling(input).token);
|
||||
return { db, scaling, saved, input };
|
||||
@@ -20,7 +20,7 @@ it('deletes policy evidence atomically while preserving lobbies, keys, and unrel
|
||||
const { db, scaling, saved } = await setup();
|
||||
db().prepare("INSERT INTO servers(name,game,map_slug,map) VALUES('t6_zombie_town_1','t6','town','zm_transit')").run();
|
||||
await scaling.runAutoscaling();
|
||||
db().prepare("INSERT INTO server_keys(server_id,pluto_key) VALUES('t5_zombie_theater_1','other-key')").run();
|
||||
db().prepare("INSERT INTO server_keys(id,game,pluto_key) VALUES('other-key','t5','other-key')").run();
|
||||
const otherSettings = { ...settings, game: 't5', mapSlug: 'theater', mode: 'off' };
|
||||
const other = scaling.saveScaling(otherSettings, undefined, undefined, scaling.previewScaling(otherSettings).token);
|
||||
for (const table of ['autoscaling_decisions', 'autoscaling_members', 'autoscaling_samples']) expect(db().prepare(`SELECT COUNT(*) AS n FROM ${table} WHERE policy_id=?`).get(saved.id)).toEqual({ n: 1 });
|
||||
|
||||
Reference in New Issue
Block a user