test: extend eight-business acceptance flows and offline contracts
This commit is contained in:
@@ -46,7 +46,9 @@ async function fixture(selector = ['--loading-plan-id', '2100000000000000001'],
|
||||
let output = ''; let errors = ''
|
||||
child.stdout.on('data', chunk => { output += chunk })
|
||||
child.stderr.on('data', chunk => { errors += chunk })
|
||||
const ready = await new Promise((resolve, reject) => {
|
||||
// Python 启动失败时也必须关闭本地消费者,否则失败用例会占住整个测试进程。
|
||||
let ready
|
||||
try { ready = await new Promise((resolve, reject) => {
|
||||
const timer = setTimeout(() => { child.kill(); reject(new Error('Proxy readiness timeout')) }, 8000)
|
||||
const onData = () => {
|
||||
const line = output.split('\n').find(item => item.trim())
|
||||
@@ -57,7 +59,14 @@ async function fixture(selector = ['--loading-plan-id', '2100000000000000001'],
|
||||
child.stdout.on('data', onData)
|
||||
child.once('error', error => { clearTimeout(timer); reject(error) })
|
||||
child.once('exit', code => { if (!output) { clearTimeout(timer); reject(new Error(`Proxy exit ${code}`)) } })
|
||||
})
|
||||
}) } catch (error) {
|
||||
if (child.exitCode === null && !child.killed) child.kill()
|
||||
await close(consumer)
|
||||
assert.equal(dirname(resolve(directory)), resolve(tmpdir()))
|
||||
assert.ok(basename(directory).startsWith('event-fault-offline-'))
|
||||
await rm(directory, { recursive: true })
|
||||
throw error
|
||||
}
|
||||
const dataUrl = `http://127.0.0.1:${ready.dataPort}${endpoint}`
|
||||
const controlUrl = `http://127.0.0.1:${ready.controlPort}`
|
||||
return { calls, applied, log, invalidAck: value => { invalidAck = value },
|
||||
|
||||
Reference in New Issue
Block a user