Skip to content

Commit

Permalink
Draft: more IPv6 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
treysis committed Mar 10, 2021
1 parent e4d93b4 commit 6aca9af
Show file tree
Hide file tree
Showing 20 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion test/common/inspector-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ class NodeInstance extends EventEmitter {

static async startViaSignal(scriptContents) {
const instance = new NodeInstance(
['--expose-internals'],
['--inspect=localhost', '--expose-internals'],
`${scriptContents}\nprocess._rawDebug('started');`, undefined);
const msg = 'Timed out waiting for process to start';
while (await fires(instance.nextStderrString(), msg, TIMEOUT) !==
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-http-localaddress.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ server.listen(0, 'localhost', () => {
port: server.address().port,
path: '/',
method: 'GET',
localAddress: 'localhost' };
localAddress: '::1' };

const req = http.request(options, function(res) {
res.on('end', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-http2-connect-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ server.listen(0, 'localhost', common.mustCall(() => {
const options = { localAddress: 'localhost' };

const client = http2.connect(
'http://localhost:' + server.address().port,
'http://[::1]:' + server.address().port,
options
);
const req = client.request({
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-https-localaddress.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ server.listen(0, 'localhost', function() {
port: this.address().port,
path: '/',
method: 'GET',
localAddress: 'localhost',
localAddress: '::1',
rejectUnauthorized: false
};

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-inspect-async-hook-setup-at-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async function checkAsyncStackTrace(session) {
}

async function runTests() {
const instance = new NodeInstance(['--inspect=::1'], script);
const instance = new NodeInstance(['--inspect=localhost'], script);
const session = await instance.connectInspectorSession();
await session.send([
{ 'method': 'Runtime.enable' },
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-inspect-publish-uid.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async function testArg(argValue) {
const hasStderr = argValue.split(',').includes('stderr');

const nodeProcess = spawnSync(process.execPath, [
'--inspect=0',
'--inspect=localhost:0',
`--inspect-publish-uid=${argValue}`,
'-e', `(${scriptMain.toString()})(${hasHttp ? 200 : 404})`
]);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-inspector-esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async function testBreakpoint(session) {
}

async function runTest() {
const child = new NodeInstance(['--inspect-brk=localhost'], '',
const child = new NodeInstance(['--inspect-brk=localhost:0'], '',
fixtures.path('es-modules/loop.mjs'));

const session = await child.connectInspectorSession();
Expand Down
3 changes: 2 additions & 1 deletion test/parallel/test-inspector-waiting-for-disconnect.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ function mainContextDestroyed(notification) {
}

async function runTest() {
const child = new NodeInstance(['--inspect-brk=0', '-e', 'process.exit(55)']);
const child = new NodeInstance(['--inspect-brk=localhost:0', '-e',
'process.exit(55)']);
const session = await child.connectInspectorSession();
const oldStyleSession = await child.connectInspectorSession();
await oldStyleSession.send([
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-tcp-wrap-connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function makeConnection() {
const client = new TCP(TCPConstants.SOCKET);

const req = new TCPConnectWrap();
const err = client.connect(req, '127.0.0.1', this.address().port);
const err = client.connect(req, '::1', this.address().port);
assert.strictEqual(err, 0);

req.oncomplete = function(status, client_, req_, readable, writable) {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-tcp-wrap-listen.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const {

const server = new TCP(TCPConstants.SOCKET);

const r = server.bind('0.0.0.0', 0);
const r = server.bind('::1', 0);
assert.strictEqual(r, 0);
let port = {};
server.getsockname(port);
Expand Down
4 changes: 2 additions & 2 deletions test/sequential/test-cluster-inspect-brk.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ if (cluster.isPrimary) {
}));
}

test(['--inspect-brk']);
test([`--inspect-brk=${debuggerPort}`]);
test(['--inspect-brk=localhost']);
test([`--inspect-brk=localhost:${debuggerPort}`]);
} else {
// Cluster worker is at a breakpoint, should not reach here.
assert.fail('Test failed: cluster worker should be at a breakpoint.');
Expand Down
4 changes: 2 additions & 2 deletions test/sequential/test-https-connect-localport.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ const assert = require('assert');
res.end();
}));

server.listen(0, 'localhost', common.mustCall(() => {
server.listen(0, '::1', common.mustCall(() => {
const port = server.address().port;
const req = https.get({
host: 'localhost',
host: '::1',
pathname: '/',
port,
family: 4,
Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-inspector-break-when-eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async function stepOverConsoleStatement(session) {
async function runTests() {
// NOTE(mmarchini): Use --inspect-brk to improve avoid undeterministic
// behavior.
const child = new NodeInstance(['--inspect-brk=0'], undefined, script);
const child = new NodeInstance(['--inspect-brk=localhost'], undefined, script);
const session = await child.connectInspectorSession();
await setupDebugger(session);
await breakOnLine(session);
Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-inspector-console.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const assert = require('assert');

async function runTest() {
const script = 'require(\'inspector\').console.log(\'hello world\');';
const child = new NodeInstance('--inspect-brk=0', script, '');
const child = new NodeInstance('--inspect-brk=localhost:0', script, '');

let out = '';
child.on('stdout', (line) => out += line);
Expand Down
4 changes: 2 additions & 2 deletions test/sequential/test-inspector-debug-end.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async function testNoServerNoCrash() {

async function testNoSessionNoCrash() {
console.log('Test there\'s no crash stopping server without connecting');
const instance = new NodeInstance('--inspect=0',
const instance = new NodeInstance('--inspect=localhost:0',
'process._debugEnd();process.exit(42);');
strictEqual((await instance.expectShutdown()).exitCode, 42);
}
Expand All @@ -28,7 +28,7 @@ async function testSessionNoCrash() {
process.exit(42);
});`;

const instance = new NodeInstance('--inspect-brk=0', script);
const instance = new NodeInstance('--inspect-brk=localhost:0', script);
const session = await instance.connectInspectorSession();
await session.send({ 'method': 'Runtime.runIfWaitingForDebugger' });
await session.waitForServerDisconnect();
Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-inspector-ip-detection.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function pickIPv4Address() {
}

async function test() {
const instance = new NodeInstance('--inspect-brk=[::]:0');
const instance = new NodeInstance('--inspect-brk=localhost:0');
try {
checkIpAddress(ip, await instance.httpGet(ip, '/json/list'));
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-inspector-not-blocked-on-idle.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { NodeInstance } = require('../common/inspector-helper.js');

async function runTests() {
const script = 'setInterval(() => {debugger;}, 60000);';
const node = new NodeInstance('--inspect=0', script);
const node = new NodeInstance('--inspect=localhost', script);
// 1 second wait to make sure the inferior began running the script
await new Promise((resolve) => setTimeout(() => resolve(), 1000));
const session = await node.connectInspectorSession();
Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-inspector-scriptparsed-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async function checkScriptContext(session, context) {
}

async function runTests() {
const instance = new NodeInstance(['--inspect-brk=0', '--expose-internals'],
const instance = new NodeInstance(['--inspect-brk=localhost:0', '--expose-internals'],
script);
const session = await instance.connectInspectorSession();
await session.send([
Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-inspector-stop-profile-after-done.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const assert = require('assert');
const { NodeInstance } = require('../common/inspector-helper.js');

async function runTests() {
const child = new NodeInstance(['--inspect-brk=0'],
const child = new NodeInstance(['--inspect-brk=localhost:0'],
`let c = 0;
const interval = setInterval(() => {
console.log(new Object());
Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-net-better-error-messages-port.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ c.on('connect', common.mustNotCall());
c.on('error', common.mustCall(function(e) {
assert.strictEqual(e.code, 'ECONNREFUSED');
assert.strictEqual(e.port, common.PORT);
assert.match(e.address, '/^127\.0\.0\.1$|^::1$/'); // eslint-disable-line
assert.match(e.address, /^127\.0\.0\.1$|^::1$/); // eslint-disable-line
}));

0 comments on commit 6aca9af

Please sign in to comment.