This commit is contained in:
2026-08-26 19:46:14 +08:00
parent 63182a2b88
commit 3975759458
22 changed files with 446 additions and 75 deletions
@@ -5,6 +5,29 @@ import test from 'node:test'
const read = async (path) => (await readFile(new URL(`../${path}`, import.meta.url), 'utf8'))
.replaceAll('\r\n', '\n')
test('local, development and test Nacos publishing remain environment-isolated', async () => {
const publisher = await read('scripts/publish-nacos-config.ps1')
const local = [
await read('config/nacos/local/gateway-overseas.yml'),
await read('config/nacos/local/lastleg-service.yml'),
await read('config/nacos/local/warehouse-overseas-service.yml'),
].join('\n')
const remote = [
await read('config/nacos/overseas/gateway-overseas.yml'),
await read('config/nacos/overseas/lastleg-service.yml'),
await read('config/nacos/overseas/warehouse-overseas-service.yml'),
].join('\n')
assert.match(publisher, /ValidateSet\('local', 'dev', 'development', 'test', 'production'\)/)
assert.match(publisher, /必须显式指定非 public 的 Nacos namespace/)
assert.match(local, /127\.0\.0\.1:9100/)
assert.match(local, /127\.0\.0\.1:9303/)
assert.doesNotMatch(remote, /127\.0\.0\.1|password:\s*123456/)
assert.match(remote, /http:\/\/lastleg-service:9303/)
assert.match(remote, /\$\{LASTLEG_DB_URL\}/)
assert.match(remote, /\$\{WAREHOUSE_DB_URL\}/)
})
test('Jenkins pipelines recognize all overseas deployable modules', async () => {
const controller = await read('Jenkinsfile')
const service = await read('Jenkinsfile.service')