ci: streamline test environment deployments
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFile } from 'node:fs/promises'
|
||||
import test from 'node:test'
|
||||
|
||||
const pipeline = (await readFile(new URL('../Jenkinsfile.service', import.meta.url), 'utf8'))
|
||||
.replaceAll('\r\n', '\n')
|
||||
|
||||
test('test deployments compile packages without rerunning the full unit test suite', () => {
|
||||
assert.match(pipeline, /params\.ENVIRONMENT == 'test' \|\| params\.SKIP_TESTS/)
|
||||
assert.match(pipeline, /skipTestExecution \? '-DskipTests' : ''/)
|
||||
assert.match(pipeline, /-pl \$\{env\.RESOLVED_SERVICE\} -am clean package/)
|
||||
assert.doesNotMatch(pipeline, /-Dmaven\.test\.skip=true/)
|
||||
})
|
||||
|
||||
test('production deployments cannot skip tests', () => {
|
||||
assert.match(pipeline, /params\.ENVIRONMENT == 'production' && params\.SKIP_TESTS/)
|
||||
assert.match(pipeline, /error\('生产环境禁止跳过测试'\)/)
|
||||
})
|
||||
Reference in New Issue
Block a user