This commit is contained in:
2026-08-25 12:27:47 +08:00
parent 0e0b6f8264
commit 4b5e5a1e4e
13 changed files with 183 additions and 33 deletions
+16
View File
@@ -111,6 +111,22 @@ test('GitLab runs the topology contract in a dedicated Node job', async () => {
assert.match(packageJob, /^ - Java拓扑合同$/m)
})
test('GitLab validates every static OpenAPI document before packaging', async () => {
const gitlab = await read('.gitlab-ci.yml')
const openapiJob = gitlab.match(/^OpenAPI有效性:\n([\s\S]*?)(?=^[^\s#].*:\n)/m)?.[1] ?? ''
const packageJob = gitlab.match(/^打包服务:\n([\s\S]*)/m)?.[1] ?? ''
assert.match(openapiJob, /^ stage: verify$/m)
assert.match(openapiJob, /^ image: node:[^\s]+$/m)
assert.match(openapiJob, /^ - npm ci --ignore-scripts --prefix scripts\/openapi-validation$/m)
assert.match(openapiJob, /^ - npm test --prefix scripts\/openapi-validation$/m)
assert.match(openapiJob, /^ - npm run validate --prefix scripts\/openapi-validation$/m)
assert.doesNotMatch(openapiJob, /\bnpx\b|@latest/)
assert.match(packageJob, /^ - Java拓扑合同$/m)
assert.match(packageJob, /^ - OpenAPI有效性$/m)
assert.match(packageJob, /^ - 校验与测试$/m)
})
test('Jenkins cannot invoke the Node contract without declaring a Node runtime', async () => {
for (const path of ['Jenkinsfile', 'Jenkinsfile.service']) {
const pipeline = await read(path)