Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/eslint.config_partial.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ export default [
'embedding',
'fixtures',
'fuzzers',
'internet',
'js-native-api',
'known_issues',
'message',
Expand Down
17 changes: 8 additions & 9 deletions test/internet/test-dgram-broadcast-multi-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ if (process.argv[2] !== 'child') {
worker.messagesReceived = [];

// Handle the death of workers
worker.on('exit', (code, signal) => {
worker.on('exit', common.mustCall((code, signal) => {
// Don't consider this the true death if the worker
// has finished successfully
// or if the exit code is 0
Expand All @@ -108,9 +108,9 @@ if (process.argv[2] !== 'child') {

process.exit(1);
}
});
}));

worker.on('message', (msg) => {
worker.on('message', common.mustCallAtLeast((msg) => {
if (msg.listening) {
listening += 1;

Expand All @@ -134,7 +134,7 @@ if (process.argv[2] !== 'child') {
'required number of ' +
'messages. Will now compare.');

Object.keys(workers).forEach((pid) => {
for (const pid of Object.keys(workers)) {
const worker = workers[pid];

let count = 0;
Expand All @@ -153,14 +153,14 @@ if (process.argv[2] !== 'child') {
count);

assert.strictEqual(count, messages.length);
});
}

clearTimeout(timer);
console.error('[PARENT] Success');
killSubprocesses(workers);
}
}
});
}));
})(x);
}

Expand Down Expand Up @@ -196,14 +196,13 @@ if (process.argv[2] !== 'child') {
buf.length,
common.PORT,
LOCAL_BROADCAST_HOST,
(err) => {
assert.ifError(err);
common.mustSucceed(() => {
console.error('[PARENT] sent %s to %s:%s',
util.inspect(buf.toString()),
LOCAL_BROADCAST_HOST, common.PORT);

process.nextTick(sendSocket.sendNext);
},
}),
);
};

Expand Down
13 changes: 6 additions & 7 deletions test/internet/test-dgram-multicast-multi-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function launchChildProcess() {
}
});

worker.on('message', function(msg) {
worker.on('message', common.mustCallAtLeast((msg) => {
if (msg.listening) {
listening += 1;

Expand All @@ -94,7 +94,7 @@ function launchChildProcess() {
console.error('[PARENT] All workers have received the ' +
'required number of messages. Will now compare.');

Object.keys(workers).forEach(function(pid) {
for (const pid of Object.keys(workers)) {
const worker = workers[pid];

let count = 0;
Expand All @@ -112,14 +112,14 @@ function launchChildProcess() {
worker.pid, count);

assert.strictEqual(count, messages.length);
});
}

clearTimeout(timer);
console.error('[PARENT] Success');
killSubprocesses(workers);
}
}
});
}));
}

function killSubprocesses(subprocesses) {
Expand Down Expand Up @@ -182,13 +182,12 @@ if (process.argv[2] !== 'child') {
buf.length,
common.PORT,
LOCAL_BROADCAST_HOST,
function(err) {
assert.ifError(err);
common.mustSucceed(() => {
console.error('[PARENT] sent "%s" to %s:%s',
buf.toString(),
LOCAL_BROADCAST_HOST, common.PORT);
process.nextTick(sendSocket.sendNext);
},
}),
);
};
}
Expand Down
13 changes: 6 additions & 7 deletions test/internet/test-dgram-multicast-set-interface-lo.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ if (process.argv[2] !== 'child') {
}
});

worker.on('message', (msg) => {
worker.on('message', common.mustCallAtLeast((msg) => {
if (msg.listening) {
listening += 1;

Expand All @@ -168,7 +168,7 @@ if (process.argv[2] !== 'child') {
'required number of ' +
'messages. Will now compare.');

Object.keys(workers).forEach((pid) => {
for (const pid of Object.keys(workers)) {
const worker = workers[pid];

let count = 0;
Expand All @@ -189,14 +189,14 @@ if (process.argv[2] !== 'child') {
assert.strictEqual(count, worker.messagesNeeded.length,
'A worker received ' +
'an invalid multicast message');
});
}

clearTimeout(timer);
console.error('[PARENT] Success');
killSubprocesses(workers);
}
}
});
}));
}

const sendSocket = dgram.createSocket({
Expand Down Expand Up @@ -234,14 +234,13 @@ if (process.argv[2] !== 'child') {
buf.length,
PORTS[msg.mcast],
msg.mcast,
(err) => {
assert.ifError(err);
common.mustSucceed(() => {
console.error('[PARENT] sent %s to %s:%s',
util.inspect(buf.toString()),
msg.mcast, PORTS[msg.mcast]);

process.nextTick(sendSocket.sendNext);
},
}),
);
};
}
Expand Down
13 changes: 6 additions & 7 deletions test/internet/test-dgram-multicast-ssm-multi-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function launchChildProcess() {
}
});

worker.on('message', function(msg) {
worker.on('message', common.mustCallAtLeast((msg) => {
if (msg.listening) {
listening += 1;

Expand All @@ -88,7 +88,7 @@ function launchChildProcess() {
console.error('[PARENT] All workers have received the ' +
'required number of messages. Will now compare.');

Object.keys(workers).forEach(function(pid) {
for (const pid of Object.keys(workers)) {
const worker = workers[pid];

let count = 0;
Expand All @@ -106,14 +106,14 @@ function launchChildProcess() {
worker.pid, count);

assert.strictEqual(count, messages.length);
});
}

clearTimeout(timer);
console.error('[PARENT] Success');
killChildren(workers);
}
}
});
}));
}

function killChildren(children) {
Expand Down Expand Up @@ -176,13 +176,12 @@ if (process.argv[2] !== 'child') {
buf.length,
common.PORT,
GROUP_ADDRESS,
function(err) {
assert.ifError(err);
common.mustSucceed((err) => {
console.error('[PARENT] sent "%s" to %s:%s',
buf.toString(),
GROUP_ADDRESS, common.PORT);
process.nextTick(sendSocket.sendNext);
},
}),
);
};
}
Expand Down
13 changes: 6 additions & 7 deletions test/internet/test-dgram-multicast-ssmv6-multi-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function launchChildProcess() {
}
});

worker.on('message', function(msg) {
worker.on('message', common.mustCallAtLeast((msg) => {
if (msg.listening) {
listening += 1;

Expand All @@ -88,7 +88,7 @@ function launchChildProcess() {
console.error('[PARENT] All workers have received the ' +
'required number of messages. Will now compare.');

Object.keys(workers).forEach(function(pid) {
for (const pid of Object.keys(workers)) {
const worker = workers[pid];

let count = 0;
Expand All @@ -106,14 +106,14 @@ function launchChildProcess() {
worker.pid, count);

assert.strictEqual(count, messages.length);
});
}

clearTimeout(timer);
console.error('[PARENT] Success');
killChildren(workers);
}
}
});
}));
}

function killChildren(children) {
Expand Down Expand Up @@ -176,13 +176,12 @@ if (process.argv[2] !== 'child') {
buf.length,
common.PORT,
GROUP_ADDRESS,
function(err) {
assert.ifError(err);
common.mustSucceed(() => {
console.error('[PARENT] sent "%s" to %s:%s',
buf.toString(),
GROUP_ADDRESS, common.PORT);
process.nextTick(sendSocket.sendNext);
},
}),
);
};
}
Expand Down
12 changes: 7 additions & 5 deletions test/internet/test-dns-any.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function checkWrap(req) {
assert.ok(typeof req === 'object');
}

/* eslint-disable node-core/must-call-assert */
const checkers = {
checkA(r) {
assert.ok(isIPv4(r.address));
Expand Down Expand Up @@ -80,13 +81,14 @@ const checkers = {
assert.strictEqual(r.type, 'SRV');
},
};
/* eslint-enable node-core/must-call-assert */

function TEST(f) {
function test(f) {
function next() {
const f = queue.shift();
if (f) {
running = true;
f(done);
f(done).then(common.mustCall());
}
}

Expand Down Expand Up @@ -115,7 +117,7 @@ function processResult(res) {
return types;
}

TEST(async function test_sip2sip_for_naptr(done) {
test(async function test_sip2sip_for_naptr(done) {
function validateResult(res) {
const types = processResult(res);
assert.ok(types.A && types.NS && types.NAPTR && types.SOA,
Expand All @@ -135,7 +137,7 @@ TEST(async function test_sip2sip_for_naptr(done) {
checkWrap(req);
});

TEST(async function test_google_for_cname_and_srv(done) {
test(async function test_google_for_cname_and_srv(done) {
function validateResult(res) {
const types = processResult(res);
assert.ok(types.SRV);
Expand All @@ -154,7 +156,7 @@ TEST(async function test_google_for_cname_and_srv(done) {
checkWrap(req);
});

TEST(async function test_ptr(done) {
test(async function test_ptr(done) {
function validateResult(res) {
const types = processResult(res);
assert.ok(types.PTR);
Expand Down
10 changes: 4 additions & 6 deletions test/internet/test-dns-cares-domains.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const assert = require('assert');
const dns = require('dns');
const domain = require('domain');

const methods = [
[
'resolve4',
'resolve6',
'resolveCname',
Expand All @@ -17,13 +17,11 @@ const methods = [
'resolvePtr',
'resolveNaptr',
'resolveSoa',
];

methods.forEach(function(method) {
].forEach(function(method) {
const d = domain.create();
d.run(function() {
d.run(common.mustCall(() => {
dns[method](addresses.INET_HOST, common.mustCall(() => {
assert.strictEqual(process.domain, d, `${method} retains domain`);
}));
});
}));
});
Loading
Loading