mirror of
https://git.openapi.site/https://github.com/desirecore/registry.git
synced 2026-12-05 10:39:02 +08:00
feat(registry): 同步算力插件固定发布契约 (#42)
This commit is contained in:
5 files changed
+325
-8
No files matched your search
@@ -88,6 +88,34 @@ test('官方根仍为4.2且global Schema保留已发布原字节', () => {
|
||||
assert.equal(createHash('sha256').update(readFileSync(join(source, 'schemas/registry-entry.schema.json'))).digest('hex'), 'ea63d6305ae17994e595aea009a131c41300d2b7fdb07ec83cc2c19c37b32038')
|
||||
})
|
||||
for (const type of ['native-app', 'web-bundle']) test('两个入口接受固定内联定义 ' + type, () => { expectValid(fixture(type)) })
|
||||
test('两个入口接受固定发布的算力插件并校验 sidecar 声明', () => {
|
||||
const root = fixture()
|
||||
const extension = {
|
||||
apiVersion: '1.0.0',
|
||||
hosts: ['agent-service'],
|
||||
runtime: {
|
||||
kind: 'service',
|
||||
protocol: 'mcp',
|
||||
descriptorRef: { path: 'runtime.json', sha256: 'a'.repeat(64) },
|
||||
},
|
||||
contributes: [{
|
||||
id: 'provider',
|
||||
point: 'compute.providers',
|
||||
contractVersion: 1,
|
||||
definitionRef: { path: 'provider.json', sha256: 'b'.repeat(64) },
|
||||
}],
|
||||
}
|
||||
const placementPolicy = { showInMyApps: false, allowNavPin: false, allowAgentBinding: false }
|
||||
mutate(root, entryFile, entry => {
|
||||
Object.assign(entry, { productKind: 'plugin', extension, entrypoints: [], placementPolicy })
|
||||
})
|
||||
mutate(root, sidecarFile, sidecar => {
|
||||
Object.assign(sidecar.spec, { productKind: 'plugin', extension, entrypointKinds: [], placementPolicy })
|
||||
})
|
||||
expectValid(root)
|
||||
mutate(root, sidecarFile, sidecar => { sidecar.spec.extension.contributes[0].definitionRef.sha256 = 'c'.repeat(64) })
|
||||
assert.ok(validateRegistry(root).errors.some(error => error.code === 'extension-mismatch'))
|
||||
})
|
||||
test('旧独立definitionPath分支继续通过', () => {
|
||||
const root = fixture()
|
||||
mutate(root, entryFile, entry => { delete entry.appRelease.definitionSource; entry.appRelease.definitionPath = 'definition.json' })
|
||||
|
||||
Reference in new issue
Block a user