refactor(tasks): simplify admission configuration
This commit is contained in:
@@ -186,12 +186,24 @@ describe('dsh-acp-demo composition', () => {
|
||||
const ctx = await mount({
|
||||
provider: 'mock',
|
||||
model: 'mock',
|
||||
tasks: { maxConcurrentTasksPerOwner: 2 },
|
||||
tasks: { maxConcurrentTasksPerOwner: 1 },
|
||||
skills: await isolatedSkillsConfig(),
|
||||
workspaceContext: false,
|
||||
})
|
||||
expect((ctx.tasks as unknown as { config: { maxConcurrentTasksPerOwner: number } })
|
||||
.config.maxConcurrentTasksPerOwner).toBe(2)
|
||||
let settle!: (outcome: { status: 'killed' }) => void
|
||||
ctx.tasks.start({
|
||||
kind: 'bash',
|
||||
label: 'hold configured slot',
|
||||
run: () => ({
|
||||
cancel: () => { settle({ status: 'killed' }) },
|
||||
done: new Promise((resolve) => { settle = resolve }),
|
||||
}),
|
||||
})
|
||||
expect(() => ctx.tasks.start({
|
||||
kind: 'bash',
|
||||
label: 'blocked configured task',
|
||||
run: () => ({ cancel: () => {}, done: Promise.resolve({ status: 'completed' }) }),
|
||||
})).toThrow('(limit: 1)')
|
||||
await ctx.fiber.dispose()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user