Skip to content

Commit 2c926dc

Browse files
committed
test: add logging for test-debug-port-cluster
The test is currently flaky and CI provides no real information because the test times out rather than failing on an assertion. Add logging to gather more information about the failure. Refs: #6754 PR-URL: #6769 Reviewed-By: Colin Ihrig <[email protected]>
1 parent 178e634 commit 2c926dc

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed
Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
11
'use strict';
2-
var common = require('../common');
3-
var assert = require('assert');
4-
var spawn = require('child_process').spawn;
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const spawn = require('child_process').spawn;
55

66
const PORT_MIN = common.PORT + 1337;
77
const PORT_MAX = PORT_MIN + 2;
88

9-
var args = [
9+
const args = [
1010
'--debug=' + PORT_MIN,
1111
common.fixturesDir + '/clustered-server/app.js'
1212
];
1313

1414
const child = spawn(process.execPath, args);
1515
child.stderr.setEncoding('utf8');
1616

17+
const checkMessages = common.mustCall(() => {
18+
for (let port = PORT_MIN; port <= PORT_MAX; port += 1) {
19+
assert(stderr.includes(`Debugger listening on port ${port}`));
20+
}
21+
});
22+
1723
let stderr = '';
1824
child.stderr.on('data', (data) => {
25+
process.stderr.write(`[DATA] ${data}`);
1926
stderr += data;
20-
if (child.killed !== true && stderr.includes('all workers are running'))
27+
if (child.killed !== true && stderr.includes('all workers are running')) {
2128
child.kill();
22-
});
23-
24-
process.on('exit', () => {
25-
for (let port = PORT_MIN; port <= PORT_MAX; port += 1)
26-
assert(stderr.includes(`Debugger listening on port ${port}`));
29+
checkMessages();
30+
}
2731
});

0 commit comments

Comments
 (0)