This commit is contained in:
2026-08-25 14:46:06 +08:00
parent 5abc7543ae
commit f325d57fc1
106 changed files with 3682 additions and 450 deletions
+30 -4
View File
@@ -62,13 +62,13 @@ const parseCompose = (yaml) => {
}))
}
test('root POM freezes 22 modules and service-map freezes 15 executable services', async () => {
test('root POM freezes 23 modules and service-map freezes 16 executable services', async () => {
const modules = parseRootModules(await read('pom.xml'))
const services = parseServiceMap(await read('deploy/service-map.yml'))
assert.equal(modules.length, 22)
assert.equal(new Set(modules).size, 22)
assert.equal(services.size, 15)
assert.equal(modules.length, 23)
assert.equal(new Set(modules).size, 23)
assert.equal(services.size, 16)
const bootModules = []
for (const module of modules) {
@@ -155,6 +155,32 @@ test('Maven verify publishes JaCoCo reports without enforcing a threshold', asyn
assert.match(gitlab, /^ - "\*\*\/target\/jacoco\.exec"$/m)
})
test('SpotBugs remains an opt-in non-blocking report without quality thresholds', async () => {
const pom = await read('pom.xml')
const gitlab = await read('.gitlab-ci.yml')
const profile = pom.match(/<profile>\s*<id>static-analysis-report<\/id>[\s\S]*?<\/profile>/)?.[0] ?? ''
const spotbugs = profile.match(/<plugin>\s*<groupId>com\.github\.spotbugs<\/groupId>[\s\S]*?<\/plugin>/)?.[0] ?? ''
const reportJob = gitlab.match(/^静态分析报告:\n([\s\S]*?)(?=^[^\s#].*:\n)/m)?.[1] ?? ''
const verifyJob = gitlab.match(/^校验与测试:\n([\s\S]*?)(?=^[^\s#].*:\n)/m)?.[1] ?? ''
const packageJob = gitlab.match(/^打包服务:\n([\s\S]*)/m)?.[1] ?? ''
assert.match(pom, /<spotbugs-maven-plugin\.version>4\.9\.8\.5<\/spotbugs-maven-plugin\.version>/)
assert.match(spotbugs, /<artifactId>spotbugs-maven-plugin<\/artifactId>/)
assert.match(spotbugs, /<phase>verify<\/phase>/)
assert.match(spotbugs, /<goal>spotbugs<\/goal>/)
assert.match(spotbugs, /<xmlOutput>true<\/xmlOutput>/)
assert.match(spotbugs, /<htmlOutput>true<\/htmlOutput>/)
assert.match(spotbugs, /<failOnError>false<\/failOnError>/)
assert.doesNotMatch(spotbugs, /<goal>check<\/goal>|<rules>|<threshold>/)
assert.doesNotMatch(pom.replace(profile, ''), /<artifactId>spotbugs-maven-plugin<\/artifactId>/)
assert.match(reportJob, /^ allow_failure: true$/m)
assert.match(reportJob, /-Pstatic-analysis-report/)
assert.match(reportJob, /^ - "\*\*\/target\/spotbugs\*\.xml"$/m)
assert.match(reportJob, /^ - "\*\*\/target\/site\/spotbugs\.html"$/m)
assert.doesNotMatch(verifyJob, /static-analysis-report|spotbugs/i)
assert.doesNotMatch(packageJob, /^ - 静态分析报告$/m)
})
test('regional Compose and Nacos manifests cover the service-map topology', async () => {
const services = parseServiceMap(await read('deploy/service-map.yml'))
const composeByRegion = new Map([