mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-10-26 16:55:08 +00:00
test(cli): keep the packed rehearsal's primary failure visible
The teardown asserted the Web process's SIGTERM exit inside `finally`, so a body failure was reported as a shutdown timeout instead of itself. The assertions now run only when the body passed, the earlier failure is rethrown after teardown, and the listener readiness became a named step that no longer clones the release pack coordinator's listen idiom.
This commit is contained in:
1 parent
eac927e143
commit
c26b658e61
2 files changed
+15
-4
No files matched your search
@@ -119,6 +119,9 @@ it.skipIf(!built)('installs the exported registry\'s local closure and switches
|
||||
})
|
||||
if (child.stdout === null) throw new Error('installed Web process has no stdout')
|
||||
const lines = createInterface({ input: child.stdout })
|
||||
// A failure in the body must stay the reported one: teardown asserts only when the body
|
||||
// passed, so a Web process that does not exit cannot replace the real error.
|
||||
let failure: unknown
|
||||
try {
|
||||
const observed = await new Promise<Observation>((resolveObservation, reject) => {
|
||||
lines.on('line', (line) => {
|
||||
@@ -161,11 +164,17 @@ it.skipIf(!built)('installs the exported registry\'s local closure and switches
|
||||
expect(record.buildId).toBe('packed-e2e')
|
||||
expect(record.packages).toHaveLength(selection.members.length)
|
||||
expect(record.packages).toEqual(expect.arrayContaining([expect.objectContaining({ name: packages[0], version })]))
|
||||
} catch (error) {
|
||||
failure = error
|
||||
} finally {
|
||||
lines.close()
|
||||
child.kill('SIGTERM')
|
||||
const result = await child
|
||||
expect(result.timedOut, `${result.stdout}\n${result.stderr}`).toBe(false)
|
||||
expect(result.exitCode === 0 || result.signal === 'SIGTERM', result.stderr).toBe(true)
|
||||
if (failure === undefined) {
|
||||
// The installed Web process stops on SIGTERM within its own budget; a timed-out child is a teardown defect.
|
||||
expect(result.timedOut, `${result.stdout}\n${result.stderr}`).toBe(false)
|
||||
expect(result.exitCode === 0 || result.signal === 'SIGTERM', result.stderr).toBe(true)
|
||||
}
|
||||
}
|
||||
if (failure !== undefined) throw failure
|
||||
})
|
||||
@@ -563,13 +563,15 @@ export async function startBundleRegistry(options: {
|
||||
response.end()
|
||||
})
|
||||
|
||||
await new Promise<void>((resolveListen, rejectListen) => {
|
||||
const listening = new Promise<void>((resolveListen, rejectListen) => {
|
||||
server.once('error', rejectListen)
|
||||
server.listen(0, '127.0.0.1', () => {
|
||||
server.once('listening', () => {
|
||||
server.off('error', rejectListen)
|
||||
resolveListen()
|
||||
})
|
||||
})
|
||||
server.listen({ port: 0, host: '127.0.0.1' })
|
||||
await listening
|
||||
const address = server.address()
|
||||
if (address === null || typeof address === 'string') {
|
||||
await closeServer(server)
|
||||
|
||||
Reference in new issue
Block a user