Skip to content

Commit

Permalink
test: allow tests to pass without internet
Browse files Browse the repository at this point in the history
Currently when running the test without an internet connection there are
two JavaScript test failures

This commit moves the two JavaScript tests to test/internet.

Backport-PR-URL: #17171
PR-URL: #16255
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
danbev authored and MylesBorins committed Nov 28, 2017
1 parent 644989c commit 6269ba3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 29 deletions.
37 changes: 37 additions & 0 deletions test/internet/test-dgram-membership.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
'use strict';

require('../common');
const assert = require('assert');
const dgram = require('dgram');
const multicastAddress = '224.0.0.114';

const setup = dgram.createSocket.bind(dgram, { type: 'udp4', reuseAddr: true });

// addMembership() with valid socket and multicast address should not throw
{
const socket = setup();
assert.doesNotThrow(() => { socket.addMembership(multicastAddress); });
socket.close();
}

// dropMembership() without previous addMembership should throw
{
const socket = setup();
assert.throws(
() => { socket.dropMembership(multicastAddress); },
/^Error: dropMembership EADDRNOTAVAIL$/
);
socket.close();
}

// dropMembership() after addMembership() should not throw
{
const socket = setup();
assert.doesNotThrow(
() => {
socket.addMembership(multicastAddress);
socket.dropMembership(multicastAddress);
}
);
socket.close();
}
29 changes: 0 additions & 29 deletions test/parallel/test-dgram-membership.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,32 +56,3 @@ const setup = dgram.createSocket.bind(dgram, {type: 'udp4', reuseAddr: true});
/^Error: dropMembership EINVAL$/);
socket.close();
}

// addMembership() with valid socket and multicast address should not throw
{
const socket = setup();
assert.doesNotThrow(() => { socket.addMembership(multicastAddress); });
socket.close();
}

// dropMembership() without previous addMembership should throw
{
const socket = setup();
assert.throws(
() => { socket.dropMembership(multicastAddress); },
/^Error: dropMembership EADDRNOTAVAIL$/
);
socket.close();
}

// dropMembership() after addMembership() should not throw
{
const socket = setup();
assert.doesNotThrow(
() => {
socket.addMembership(multicastAddress);
socket.dropMembership(multicastAddress);
}
);
socket.close();
}

0 comments on commit 6269ba3

Please sign in to comment.