From f5162009642c795a542ea6b40a65e9d3d3e8bf47 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 23 Nov 2015 16:01:35 -0800 Subject: [PATCH] test: skip test if in FreeBSD jail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test test-net-socket-local-address is flaky in FreeBSD jail but robust otherwise. Fixes: https://github.com/nodejs/node/issues/2475 PR-URL: https://github.com/nodejs/node/pull/3995 Reviewed-By: Rod Vagg Reviewed-By: Johan Bergström Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig --- test/parallel/parallel.status | 1 - .../parallel/test-net-socket-local-address.js | 20 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status index d0513f77ff6835..dcab91464d1c62 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -21,4 +21,3 @@ test-child-process-exit-code : PASS,FLAKY test-debug-signal-cluster : PASS,FLAKY [$system==freebsd] -test-net-socket-local-address : PASS,FLAKY diff --git a/test/parallel/test-net-socket-local-address.js b/test/parallel/test-net-socket-local-address.js index 4c0e31d08c4771..502c2d226d54b8 100644 --- a/test/parallel/test-net-socket-local-address.js +++ b/test/parallel/test-net-socket-local-address.js @@ -1,24 +1,30 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var net = require('net'); +const common = require('../common'); +const assert = require('assert'); +const net = require('net'); + +// skip test in FreeBSD jails +if (common.inFreeBSDJail) { + console.log('1..0 # Skipped: In a FreeBSD jail'); + return; +} var conns = 0; var clientLocalPorts = []; var serverRemotePorts = []; -var server = net.createServer(function(socket) { +const server = net.createServer(function(socket) { serverRemotePorts.push(socket.remotePort); conns++; }); -var client = new net.Socket(); +const client = new net.Socket(); -server.on('close', function() { +server.on('close', common.mustCall(function() { assert.deepEqual(clientLocalPorts, serverRemotePorts, 'client and server should agree on the ports used'); assert.equal(2, conns); -}); +})); server.listen(common.PORT, common.localhostIPv4, testConnect);