fix(ci): ignore stale Surefire reports
This commit is contained in:
Vendored
+1
@@ -295,6 +295,7 @@ pipeline {
|
|||||||
echo "统一测试本次选中的服务及其公共依赖: ${selectedModules}"
|
echo "统一测试本次选中的服务及其公共依赖: ${selectedModules}"
|
||||||
sh """
|
sh """
|
||||||
test \"\$(git rev-parse HEAD)\" = \"${env.SOURCE_COMMIT}\"
|
test \"\$(git rev-parse HEAD)\" = \"${env.SOURCE_COMMIT}\"
|
||||||
|
find . -type f -path '*/target/surefire-reports/TEST-*.xml' -delete
|
||||||
mvn --settings deploy/maven/settings-ci.xml --batch-mode --errors -pl ${selectedModules} -am test
|
mvn --settings deploy/maven/settings-ci.xml --batch-mode --errors -pl ${selectedModules} -am test
|
||||||
"""
|
"""
|
||||||
echo "统一测试门禁通过: ${env.SOURCE_COMMIT};下游单服务任务不再重复执行测试"
|
echo "统一测试门禁通过: ${env.SOURCE_COMMIT};下游单服务任务不再重复执行测试"
|
||||||
|
|||||||
@@ -17,10 +17,17 @@ test('coordinator releases its builder while waiting for downstream jobs', () =>
|
|||||||
test('coordinator runs selected tests once before parallel service packaging', () => {
|
test('coordinator runs selected tests once before parallel service packaging', () => {
|
||||||
const gateIndex = pipeline.indexOf("stage('统一 Maven 测试门禁')")
|
const gateIndex = pipeline.indexOf("stage('统一 Maven 测试门禁')")
|
||||||
const dispatchIndex = pipeline.indexOf("stage('并行调度独立服务 Job')")
|
const dispatchIndex = pipeline.indexOf("stage('并行调度独立服务 Job')")
|
||||||
|
const staleReportCleanupIndex = pipeline.indexOf(
|
||||||
|
"find . -type f -path '*/target/surefire-reports/TEST-*.xml' -delete"
|
||||||
|
)
|
||||||
|
const selectedTestIndex = pipeline.indexOf('-pl ${selectedModules} -am test')
|
||||||
|
|
||||||
assert.ok(gateIndex >= 0, 'unified test gate must exist')
|
assert.ok(gateIndex >= 0, 'unified test gate must exist')
|
||||||
assert.ok(dispatchIndex > gateIndex, 'unified tests must finish before downstream dispatch')
|
assert.ok(dispatchIndex > gateIndex, 'unified tests must finish before downstream dispatch')
|
||||||
|
assert.ok(staleReportCleanupIndex > gateIndex, 'stale Surefire reports must be removed inside the test gate')
|
||||||
|
assert.ok(selectedTestIndex > staleReportCleanupIndex, 'stale reports must be removed before selected tests run')
|
||||||
assert.match(pipeline, /-pl \$\{selectedModules\} -am test/)
|
assert.match(pipeline, /-pl \$\{selectedModules\} -am test/)
|
||||||
|
assert.match(pipeline, /junit allowEmptyResults: true, testResults: '\*\*\/target\/surefire-reports\/TEST-\*\.xml'/)
|
||||||
assert.match(pipeline, /booleanParam\(name: 'SKIP_TESTS', value: true\)/)
|
assert.match(pipeline, /booleanParam\(name: 'SKIP_TESTS', value: true\)/)
|
||||||
assert.doesNotMatch(pipeline, /TESTED_COMMIT/)
|
assert.doesNotMatch(pipeline, /TESTED_COMMIT/)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user