mirror of
https://github.com/whyour/qinglong.git
synced 2026-09-20 16:07:11 +08:00
feat(ql3): establish 3.0 incubation baseline
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
const assert = require('node:assert/strict');
|
||||
const { test } = require('node:test');
|
||||
|
||||
const {
|
||||
CLUSTER_PLUGIN_PACKAGE_DISPATCH_BATCH_LIMIT,
|
||||
createClusterPluginPackageApprovedActionDispatcher,
|
||||
} = require('@qinglong/cluster-admin/plugin-package-approved-action');
|
||||
|
||||
test('composes one bounded caller-driven cluster Package dispatcher', async () => {
|
||||
const pool = {
|
||||
async query() {
|
||||
throw new Error('construction must not touch PostgreSQL');
|
||||
},
|
||||
async connect() {
|
||||
throw new Error('construction must not open PostgreSQL');
|
||||
},
|
||||
};
|
||||
const dispatcher = createClusterPluginPackageApprovedActionDispatcher({
|
||||
pool,
|
||||
owner: 'cluster_package_dispatcher_1',
|
||||
clock: () => 100,
|
||||
createId: () => 'dispatcher-id-1',
|
||||
});
|
||||
let observedLimit = null;
|
||||
dispatcher.repository.listDueExecutions = async (query) => {
|
||||
observedLimit = query.limit;
|
||||
return { executions: [], truncated: false };
|
||||
};
|
||||
const summary = await dispatcher.dispatchBatch();
|
||||
assert.equal(summary.scanned, 0);
|
||||
assert.equal(summary.truncated, false);
|
||||
assert.equal(observedLimit, CLUSTER_PLUGIN_PACKAGE_DISPATCH_BATCH_LIMIT);
|
||||
assert.equal(
|
||||
require('@qinglong/cluster-admin')
|
||||
.createClusterPluginPackageApprovedActionDispatcher,
|
||||
undefined,
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user