Add fleet and per-host concurrency controls
This commit is contained in:
@@ -1372,3 +1372,21 @@ describe('cancelled native mutation bookkeeping', () => {
|
||||
expect(db().prepare('SELECT * FROM ec_host_ports WHERE host_id=?').all(hostId)).toHaveLength(delivered ? 0 : 2);
|
||||
});
|
||||
});
|
||||
|
||||
describe('additional concurrency admission', () => {
|
||||
it.each(['createConcurrencyPerHost', 'lifecycleConcurrency'] as const)('holds simultaneous startups with %s until recovery completes', async key => {
|
||||
const first = await queue();
|
||||
const { fleetSettings, saveFleetSettings } = await import('../../src/lib/server/settings.js');
|
||||
saveFleetSettings({ ...fleetSettings(), createConcurrency: 5, [key]: 1 });
|
||||
const { queueCreateServer } = await import('../../src/lib/server/provisioning/instances.js');
|
||||
const second = queueCreateServer({ game: 't5', gameMode: 'zombie', mapSlug: 'theater', hostId, libraryId, image, plutoKey: 'second-key' });
|
||||
if (!second.ok) throw new Error(second.message);
|
||||
await advance();
|
||||
const operations = [await operationFor(first.deploymentId), await operationFor(second.deploymentId)];
|
||||
expect(operations.filter(Boolean)).toHaveLength(1);
|
||||
expect((await detail(second.deploymentId)).stage).toContain('capacity');
|
||||
saveFleetSettings({ ...fleetSettings(), [key]: 0 });
|
||||
await advance();
|
||||
expect(await operationFor(second.deploymentId)).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user