Skip to content

Commit

Permalink
test: refactor pummel/test-net-pingpong
Browse files Browse the repository at this point in the history
* Use port 0 instead of `common.PORT`.
* Use `//` for comments, capitalize comments, and add punctuation.

PR-URL: #25485
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
  • Loading branch information
Trott authored and MylesBorins committed May 16, 2019
1 parent 47cf1a2 commit e5b305d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/pummel/test-net-pingpong.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const net = require('net');

let tests_run = 0;

function pingPongTest(port, host, on_complete) {
function pingPongTest(host, on_complete) {
const N = 1000;
let count = 0;
let sent_final_ping = false;
Expand Down Expand Up @@ -69,8 +69,8 @@ function pingPongTest(port, host, on_complete) {
});
});

server.listen(port, host, function() {
const client = net.createConnection(port, host);
server.listen(0, host, function() {
const client = net.createConnection(server.address().port, host);

client.setEncoding('utf8');

Expand Down Expand Up @@ -110,12 +110,12 @@ function pingPongTest(port, host, on_complete) {
});
}

/* All are run at once, so run on different ports */
pingPongTest(common.PORT, 'localhost');
pingPongTest(common.PORT + 1, null);
// All are run at once and will run on different ports.
pingPongTest('localhost');
pingPongTest(null);

// This IPv6 isn't working on Solaris
if (!common.isSunOS) pingPongTest(common.PORT + 2, '::1');
// This IPv6 isn't working on Solaris.
if (!common.isSunOS) pingPongTest('::1');

process.on('exit', function() {
assert.strictEqual(tests_run, common.isSunOS ? 2 : 3);
Expand Down

0 comments on commit e5b305d

Please sign in to comment.