Queue native collection launches before async placement
This commit is contained in:
@@ -83,6 +83,33 @@ async function pausePreparation() {
|
||||
}
|
||||
|
||||
describe('asynchronous native launch preparation', () => {
|
||||
it('does not place an unsubmitted intent cancelled while host ranking is pending', async () => {
|
||||
const job = await queue();
|
||||
const preparation = await import('../../src/lib/server/provisioning/launch-preparation.js');
|
||||
const evaluate = preparation.evaluateNativePlacement;
|
||||
let started!: () => void;
|
||||
let release!: () => void;
|
||||
const ready = new Promise<void>(resolve => { started = resolve; });
|
||||
const gate = new Promise<void>(resolve => { release = resolve; });
|
||||
releases.push(release);
|
||||
vi.spyOn(preparation, 'evaluateNativePlacement').mockImplementationOnce(async input => {
|
||||
const result = await evaluate(input);
|
||||
started(); await gate;
|
||||
return result;
|
||||
});
|
||||
const pass = runPass();
|
||||
await ready;
|
||||
const { nativeInstance } = await import('../../src/lib/server/backends/native.js');
|
||||
expect(nativeInstance(job.name)).toBeNull();
|
||||
const { cancelCreation } = await import('../../src/lib/server/provisioning/cancel-creation.js');
|
||||
expect(cancelCreation(job.deploymentId)).toEqual(expect.any(String));
|
||||
release(); await pass;
|
||||
expect(nativeInstance(job.name)).toBeNull();
|
||||
expect(await operationFor(job.deploymentId)).toBeUndefined();
|
||||
const { db } = await import('../../src/lib/server/db/index.js');
|
||||
expect(db().prepare('SELECT instance_id FROM ec_host_ports').all()).toEqual([]);
|
||||
});
|
||||
|
||||
it('keeps controller timers and launch details responsive while preparing multiple large plugins', async () => {
|
||||
const { createScript } = await import('../../src/lib/server/fleet/scripts.js');
|
||||
const { db } = await import('../../src/lib/server/db/index.js');
|
||||
|
||||
Reference in New Issue
Block a user