Skip to content

Commit

Permalink
test: skip test if in FreeBSD jail
Browse files Browse the repository at this point in the history
Test test-net-socket-local-address is flaky in FreeBSD jail but robust
otherwise.

Fixes: #2475
PR-URL: #3995
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
Trott authored and jasnell committed Dec 17, 2015
1 parent cc24f0e commit 38ba152
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
1 change: 0 additions & 1 deletion test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 13 additions & 7 deletions test/parallel/test-net-socket-local-address.js
Original file line number Diff line number Diff line change
@@ -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);

Expand Down

0 comments on commit 38ba152

Please sign in to comment.