Skip to content

Commit

Permalink
test: add logging for test-debug-port-cluster
Browse files Browse the repository at this point in the history
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: nodejs#6754
  • Loading branch information
Trott committed May 15, 2016
1 parent f4f6c6e commit f547ca6
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/parallel/test-debug-port-cluster.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'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'
];
Expand All @@ -16,12 +16,12 @@ child.stderr.setEncoding('utf8');

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}`));
for (let port = PORT_MIN; port <= PORT_MAX; port += 1) {
assert(stderr.includes(`Debugger listening on port ${port}`));
}
}
});

0 comments on commit f547ca6

Please sign in to comment.