fix(acceptance): target deployed TEST Firstleg container for read-only audits
This commit is contained in:
@@ -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'\]/)
|
||||||
|
|||||||
Reference in New Issue
Block a user