Skip to content

Commit a703b1b

Browse files
TrottFishrock123
authored andcommitted
test: remove time check
test-child-process-fork-net2.js checks that things happen within certain time constraints, thus doubling as a benchmark test in addition to a functionality test. This change removes the time check, as it was causing the test to fail on SmartOS and Windows (and possibly elsewhere) when the tests were run in parallel on CI. There is no guarantee that other tests won't consume enough resources to slow this test down, so don't check the time constraints (beyond the generous timeout that the test is given by test.py in the first place, of course). If we want to do benchmark/performance tests, we should keep them separate from pure functionality tests. The time check may have been a remnant of the distant past when Node.js was much slower. It predates io.js Ref: #4476 PR-URL: #4494 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Johan Bergström <[email protected]>
1 parent 02b3a5b commit a703b1b

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

test/parallel/test-child-process-fork-net2.js

+2-20
Original file line numberDiff line numberDiff line change
@@ -117,47 +117,29 @@ if (process.argv[2] === 'child') {
117117
});
118118

119119
var closeEmitted = false;
120-
server.on('close', function() {
121-
console.error('[m] server close');
120+
server.on('close', common.mustCall(function() {
122121
closeEmitted = true;
123122

124-
console.error('[m] killing child processes');
125123
child1.kill();
126124
child2.kill();
127125
child3.kill();
128-
});
126+
}));
129127

130128
server.listen(common.PORT, '127.0.0.1');
131129

132-
var timeElapsed = 0;
133130
var closeServer = function() {
134-
console.error('[m] closeServer');
135-
var startTime = Date.now();
136-
server.on('close', function() {
137-
console.error('[m] emit(close)');
138-
timeElapsed = Date.now() - startTime;
139-
});
140-
141-
console.error('[m] calling server.close');
142131
server.close();
143132

144133
setTimeout(function() {
145134
assert(!closeEmitted);
146-
console.error('[m] sending close to children');
147135
child1.send('close');
148136
child2.send('close');
149137
child3.disconnect();
150138
}, 200);
151139
};
152140

153-
var min = 190;
154-
var max = common.platformTimeout(2000);
155141
process.on('exit', function() {
156142
assert.equal(disconnected, count);
157143
assert.equal(connected, count);
158-
assert.ok(closeEmitted);
159-
assert.ok(timeElapsed >= min && timeElapsed <= max,
160-
`timeElapsed was not between ${min} and ${max} ms:` +
161-
`${timeElapsed}`);
162144
});
163145
}

0 commit comments

Comments
 (0)