fix(acceptance): target deployed TEST Firstleg container for read-only audits

This commit is contained in:
2026-10-03 23:39:06 +08:00
parent 1f7ddf7bc9
commit 19e9913f30
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -131,7 +131,7 @@ const base64Expression = value => '['+Buffer.from(value).toString('base64').matc
export function buildEvidenceRemoteScript(service, sql, agent) { export function buildEvidenceRemoteScript(service, sql, agent) {
assertReadOnlySql(sql) assertReadOnlySql(sql)
if (!['order','firstleg','lastleg'].includes(service) || !/^[A-Za-z0-9_.-]{1,128}$/.test(agent)) throw Error('Invalid TEST evidence target') if (!['order','firstleg','lastleg'].includes(service) || !/^[A-Za-z0-9_.-]{1,128}$/.test(agent)) throw Error('Invalid TEST evidence target')
const prefix=service.toUpperCase(),container=`firstleg-test-${service}` const prefix=service.toUpperCase(),container=service==='firstleg'?'firstleg-test-business':`firstleg-test-${service}`
const python = `import json,os,subprocess,urllib.parse,base64,re const python = `import json,os,subprocess,urllib.parse,base64,re
try: try:
c=json.loads(subprocess.check_output(['docker','inspect','${container}'],text=True,stderr=subprocess.DEVNULL))[0] c=json.loads(subprocess.check_output(['docker','inspect','${container}'],text=True,stderr=subprocess.DEVNULL))[0]
@@ -63,8 +63,8 @@ test('Firstleg receiver evidence stays on its exact TEST container and rejects w
const sql = buildCompletionEvidenceSql(completion()) const sql = buildCompletionEvidenceSql(completion())
const decode = value => Buffer.from([...value.matchAll(/'([A-Za-z0-9+/=]{40,})'/g)].map(m => m[1]).join(''), 'base64').toString('utf8') const decode = value => Buffer.from([...value.matchAll(/'([A-Za-z0-9+/=]{40,})'/g)].map(m => m[1]).join(''), 'base64').toString('utf8')
const python = decode(decode(buildEvidenceRemoteScript('firstleg', sql, 'java-test-agent'))) const python = decode(decode(buildEvidenceRemoteScript('firstleg', sql, 'java-test-agent')))
assert.match(python, /docker','inspect','firstleg-test-firstleg'/) assert.match(python, /docker','inspect','firstleg-test-business'/)
assert.match(python, /get\('Name'\)!='\/firstleg-test-firstleg'/) assert.match(python, /get\('Name'\)!='\/firstleg-test-business'/)
assert.match(python, /com\.docker\.compose\.project'\)!='firstleg-test'/) assert.match(python, /com\.docker\.compose\.project'\)!='firstleg-test'/)
assert.match(python, /e\['FIRSTLEG_DB_URL'\]/) assert.match(python, /e\['FIRSTLEG_DB_URL'\]/)
assert.match(python, /e\['FIRSTLEG_DB_USERNAME'\]/) assert.match(python, /e\['FIRSTLEG_DB_USERNAME'\]/)