mirror of
https://github.com/whyour/qinglong.git
synced 2026-09-21 18:08:20 +08:00
feat(ql3): establish 3.0 incubation baseline
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
const assert = require('node:assert/strict');
|
||||
const { test } = require('node:test');
|
||||
|
||||
const {
|
||||
CLUSTER_PLUGIN_PACKAGE_MANAGEMENT_DECISION_MODE,
|
||||
createClusterPluginPackageManagementService,
|
||||
} = require('@qinglong/cluster-admin/plugin-package-management');
|
||||
|
||||
test('composes cluster Package management as short-lived separation-of-duty authority', () => {
|
||||
const pool = {
|
||||
async query() {
|
||||
throw new Error('construction must not touch PostgreSQL');
|
||||
},
|
||||
async connect() {
|
||||
throw new Error('construction must not open PostgreSQL');
|
||||
},
|
||||
};
|
||||
const service = createClusterPluginPackageManagementService({
|
||||
pool,
|
||||
now: () => 100,
|
||||
});
|
||||
assert.equal(
|
||||
CLUSTER_PLUGIN_PACKAGE_MANAGEMENT_DECISION_MODE,
|
||||
'separation_of_duty',
|
||||
);
|
||||
assert.equal(typeof service.propose, 'function');
|
||||
assert.equal(typeof service.decide, 'function');
|
||||
assert.equal(typeof service.inspect, 'function');
|
||||
assert.equal(typeof service.inspectAuthorized, 'function');
|
||||
assert.equal(typeof service.inspectInstallationAuthorized, 'function');
|
||||
assert.equal(typeof service.listInstallationsAuthorized, 'function');
|
||||
assert.deepEqual(Object.keys(service).sort(), [
|
||||
'decide',
|
||||
'inspect',
|
||||
'inspectAuthorized',
|
||||
'inspectInstallationAuthorized',
|
||||
'listInstallationsAuthorized',
|
||||
'propose',
|
||||
]);
|
||||
assert.equal(
|
||||
require('@qinglong/cluster-admin')
|
||||
.createClusterPluginPackageManagementService,
|
||||
undefined,
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user