mirror of
https://github.com/whyour/qinglong.git
synced 2026-09-23 20:15:19 +08:00
feat(ql3): add bounded legacy panel cron adapter
This commit is contained in:
@@ -303,6 +303,17 @@ function fixture(overrides = {}) {
|
||||
return { statusCode: 201, body: { status: 'inserted' } };
|
||||
},
|
||||
},
|
||||
panelCronListRoute: {
|
||||
async handle(value) {
|
||||
events.push(
|
||||
`panel-crons:${value.projectId}:${value.page}:${value.size}:${value.maximumRows}`,
|
||||
);
|
||||
return {
|
||||
statusCode: 200,
|
||||
body: { code: 200, data: { data: [], total: 0 } },
|
||||
};
|
||||
},
|
||||
},
|
||||
now: () => 10_000,
|
||||
randomUuid: () => '019f70c0-0000-4000-8000-000000000002',
|
||||
...overrides,
|
||||
@@ -508,6 +519,35 @@ test('uses task.read with a route-owned task.get audit identity', async () => {
|
||||
]);
|
||||
});
|
||||
|
||||
test('uses task.read and the exact panel Cron audit identity for the compatibility projection', async () => {
|
||||
const { admission, events } = fixture();
|
||||
assert.deepEqual(
|
||||
await execute(
|
||||
admission,
|
||||
request({
|
||||
operation: Object.freeze({
|
||||
operationId: 'panel.cron.list',
|
||||
projectId: 'default',
|
||||
page: 1,
|
||||
size: 20,
|
||||
maximumRows: 64,
|
||||
}),
|
||||
}),
|
||||
),
|
||||
{
|
||||
statusCode: 200,
|
||||
body: { code: 200, data: { data: [], total: 0 } },
|
||||
},
|
||||
);
|
||||
assert.deepEqual(events, [
|
||||
'authenticate',
|
||||
'authorize:task.read:default',
|
||||
'audit:allowed:panel.cron.list',
|
||||
'confirm',
|
||||
'panel-crons:default:1:20:64',
|
||||
]);
|
||||
});
|
||||
|
||||
test('authorizes and audits run.stop before exposing the cancellation body handler', async () => {
|
||||
const { admission, events } = fixture();
|
||||
const prepared = await admission.prepare(
|
||||
|
||||
Reference in New Issue
Block a user