Browse Source

test: fix flaky test-child-process-fork-net

Reduce client connections from 10 to 4 in a test that is causing issues
on Raspberry Pi 2 devices in CI.

Fixes: https://github.com/nodejs/node/issues/5122
PR-URL: https://github.com/nodejs/node/pull/6138
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
v6.x
Rich Trott 9 years ago
committed by James M Snell
parent
commit
5a26849e1d
  1. 16
      test/parallel/test-child-process-fork-net.js

16
test/parallel/test-child-process-fork-net.js

@ -1,8 +1,8 @@
'use strict'; 'use strict';
var assert = require('assert'); const assert = require('assert');
var common = require('../common'); const common = require('../common');
var fork = require('child_process').fork; const fork = require('child_process').fork;
var net = require('net'); const net = require('net');
// progress tracker // progress tracker
function ProgressTracker(missing, callback) { function ProgressTracker(missing, callback) {
@ -76,9 +76,9 @@ if (process.argv[2] === 'child') {
server.close(); server.close();
}); });
// we expect 10 connections and close events // we expect 4 connections and close events
var connections = new ProgressTracker(10, progress.done.bind(progress)); var connections = new ProgressTracker(4, progress.done.bind(progress));
var closed = new ProgressTracker(10, progress.done.bind(progress)); var closed = new ProgressTracker(4, progress.done.bind(progress));
// create server and send it to child // create server and send it to child
var server = net.createServer(); var server = net.createServer();
@ -99,7 +99,7 @@ if (process.argv[2] === 'child') {
if (msg.what === 'listening') { if (msg.what === 'listening') {
// make connections // make connections
var socket; var socket;
for (var i = 0; i < 10; i++) { for (var i = 0; i < 4; i++) {
socket = net.connect(common.PORT, function() { socket = net.connect(common.PORT, function() {
console.log('CLIENT: connected'); console.log('CLIENT: connected');
}); });

Loading…
Cancel
Save