Skip to content

Commit be51c2e

Browse files
committed
fix(e2e): better serve debug: lsof port check, pstree, 10s wait
1 parent 7917eea commit be51c2e

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

integration/models/application.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,23 @@ export const application = (
180180

181181
if (opts.detached) {
182182
// Give the process a moment to start, then check its state
183-
await new Promise(res => setTimeout(res, 3000));
183+
await new Promise(res => setTimeout(res, 10000));
184184
try {
185-
const procExists = execSync(`kill -0 ${proc.pid} 2>&1 && echo "alive" || echo "dead"`, {
185+
const procAlive = execSync(`kill -0 ${proc.pid} 2>&1 && echo "alive" || echo "dead"`, {
186186
encoding: 'utf-8',
187187
}).trim();
188-
log(`Serve process ${proc.pid} status after 3s: ${procExists}`);
189-
const ssOut = execSync(`ss -tlnp 2>&1 | head -20 || true`, { encoding: 'utf-8' });
190-
log(`Listening ports:\n${ssOut}`);
191-
} catch {
192-
log('Could not check serve process status');
188+
log(`Serve process ${proc.pid} status after 10s: ${procAlive}`);
189+
// Check port binding
190+
const portCheck = execSync(
191+
`lsof -i :${port} -P -n 2>&1 || echo "(lsof: no results)"`,
192+
{ encoding: 'utf-8' },
193+
);
194+
log(`Port ${port} check:\n${portCheck}`);
195+
// Check process tree
196+
const pstree = execSync(`pstree -p ${proc.pid} 2>&1 || echo "(pstree failed)"`, { encoding: 'utf-8' });
197+
log(`Process tree:\n${pstree}`);
198+
} catch (debugErr) {
199+
log(`Debug check error: ${debugErr}`);
193200
}
194201

195202
const shouldExit = () => {

0 commit comments

Comments
 (0)