-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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]>
- Loading branch information
Showing
1 changed file
with
14 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
'use strict'; | ||
var common = require('../common'); | ||
var assert = require('assert'); | ||
var spawn = require('child_process').spawn; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const spawn = require('child_process').spawn; | ||
|
||
const PORT_MIN = common.PORT + 1337; | ||
const PORT_MAX = PORT_MIN + 2; | ||
|
||
var args = [ | ||
const args = [ | ||
'--debug=' + PORT_MIN, | ||
common.fixturesDir + '/clustered-server/app.js' | ||
]; | ||
|
||
const child = spawn(process.execPath, args); | ||
child.stderr.setEncoding('utf8'); | ||
|
||
const checkMessages = common.mustCall(() => { | ||
for (let port = PORT_MIN; port <= PORT_MAX; port += 1) { | ||
assert(stderr.includes(`Debugger listening on port ${port}`)); | ||
} | ||
}); | ||
|
||
let stderr = ''; | ||
child.stderr.on('data', (data) => { | ||
process.stderr.write(`[DATA] ${data}`); | ||
stderr += data; | ||
if (child.killed !== true && stderr.includes('all workers are running')) | ||
if (child.killed !== true && stderr.includes('all workers are running')) { | ||
child.kill(); | ||
}); | ||
|
||
process.on('exit', () => { | ||
for (let port = PORT_MIN; port <= PORT_MAX; port += 1) | ||
assert(stderr.includes(`Debugger listening on port ${port}`)); | ||
checkMessages(); | ||
} | ||
}); |