test: rename some allegories
PR-URL: https://github.com/nodejs/node/pull/22307 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
This commit is contained in:
parent
4ce744a24b
commit
682f9b4709
@ -70,7 +70,7 @@ if (process.argv[2] !== 'child') {
|
|||||||
TIMEOUT);
|
TIMEOUT);
|
||||||
console.error('[PARENT] Fail');
|
console.error('[PARENT] Fail');
|
||||||
|
|
||||||
killChildren(workers);
|
killSubprocesses(workers);
|
||||||
|
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}, TIMEOUT);
|
}, TIMEOUT);
|
||||||
@ -102,7 +102,7 @@ if (process.argv[2] !== 'child') {
|
|||||||
console.error('[PARENT] All workers have died.');
|
console.error('[PARENT] All workers have died.');
|
||||||
console.error('[PARENT] Fail');
|
console.error('[PARENT] Fail');
|
||||||
|
|
||||||
killChildren(workers);
|
killSubprocesses(workers);
|
||||||
|
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ if (process.argv[2] !== 'child') {
|
|||||||
|
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
console.error('[PARENT] Success');
|
console.error('[PARENT] Success');
|
||||||
killChildren(workers);
|
killSubprocesses(workers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -203,10 +203,10 @@ if (process.argv[2] !== 'child') {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function killChildren(children) {
|
function killSubprocesses(subprocesses) {
|
||||||
Object.keys(children).forEach(function(key) {
|
Object.keys(subprocesses).forEach(function(key) {
|
||||||
const child = children[key];
|
const subprocess = subprocesses[key];
|
||||||
child.kill();
|
subprocess.kill();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,16 +116,16 @@ function launchChildProcess() {
|
|||||||
|
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
console.error('[PARENT] Success');
|
console.error('[PARENT] Success');
|
||||||
killChildren(workers);
|
killSubprocesses(workers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function killChildren(children) {
|
function killSubprocesses(subprocesses) {
|
||||||
Object.keys(children).forEach(function(key) {
|
Object.keys(subprocesses).forEach(function(key) {
|
||||||
const child = children[key];
|
const subprocess = subprocesses[key];
|
||||||
child.kill();
|
subprocess.kill();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ if (process.argv[2] !== 'child') {
|
|||||||
TIMEOUT);
|
TIMEOUT);
|
||||||
console.error('[PARENT] Fail');
|
console.error('[PARENT] Fail');
|
||||||
|
|
||||||
killChildren(workers);
|
killSubprocesses(workers);
|
||||||
|
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}, TIMEOUT);
|
}, TIMEOUT);
|
||||||
|
@ -89,7 +89,7 @@ if (process.argv[2] !== 'child') {
|
|||||||
TIMEOUT);
|
TIMEOUT);
|
||||||
console.error('[PARENT] Skip');
|
console.error('[PARENT] Skip');
|
||||||
|
|
||||||
killChildren(workers);
|
killSubprocesses(workers);
|
||||||
common.skip('Check filter policy');
|
common.skip('Check filter policy');
|
||||||
|
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
@ -132,7 +132,7 @@ if (process.argv[2] !== 'child') {
|
|||||||
console.error('[PARENT] All workers have died.');
|
console.error('[PARENT] All workers have died.');
|
||||||
console.error('[PARENT] Fail');
|
console.error('[PARENT] Fail');
|
||||||
|
|
||||||
killChildren(workers);
|
killSubprocesses(workers);
|
||||||
|
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
@ -187,7 +187,7 @@ if (process.argv[2] !== 'child') {
|
|||||||
|
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
console.error('[PARENT] Success');
|
console.error('[PARENT] Success');
|
||||||
killChildren(workers);
|
killSubprocesses(workers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -239,9 +239,9 @@ if (process.argv[2] !== 'child') {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function killChildren(children) {
|
function killSubprocesses(subprocesses) {
|
||||||
for (const i in children)
|
for (const i in subprocesses)
|
||||||
children[i].kill();
|
subprocesses[i].kill();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ if (process.argv[2] === 'child') {
|
|||||||
while (j--) {
|
while (j--) {
|
||||||
const client = net.connect(this.address().port, '127.0.0.1');
|
const client = net.connect(this.address().port, '127.0.0.1');
|
||||||
client.on('error', function() {
|
client.on('error', function() {
|
||||||
// This can happen if we kill the child too early.
|
// This can happen if we kill the subprocess too early.
|
||||||
// The client should still get a close event afterwards.
|
// The client should still get a close event afterwards.
|
||||||
console.error('[m] CLIENT: error event');
|
console.error('[m] CLIENT: error event');
|
||||||
});
|
});
|
||||||
|
@ -53,7 +53,7 @@ function test() {
|
|||||||
function next() {
|
function next() {
|
||||||
console.error('output from parent = %s', json);
|
console.error('output from parent = %s', json);
|
||||||
const child = JSON.parse(json);
|
const child = JSON.parse(json);
|
||||||
// now make sure that we can request to the child, then kill it.
|
// now make sure that we can request to the subprocess, then kill it.
|
||||||
http.get({
|
http.get({
|
||||||
server: 'localhost',
|
server: 'localhost',
|
||||||
port: child.port,
|
port: child.port,
|
||||||
@ -64,7 +64,7 @@ function test() {
|
|||||||
s += c.toString();
|
s += c.toString();
|
||||||
});
|
});
|
||||||
res.on('end', function() {
|
res.on('end', function() {
|
||||||
// kill the child before we start doing asserts.
|
// kill the subprocess before we start doing asserts.
|
||||||
// it's really annoying when tests leave orphans!
|
// it's really annoying when tests leave orphans!
|
||||||
process.kill(child.pid, 'SIGKILL');
|
process.kill(child.pid, 'SIGKILL');
|
||||||
try {
|
try {
|
||||||
|
@ -53,7 +53,7 @@ function test() {
|
|||||||
function next() {
|
function next() {
|
||||||
console.error('output from parent = %s', json);
|
console.error('output from parent = %s', json);
|
||||||
const child = JSON.parse(json);
|
const child = JSON.parse(json);
|
||||||
// now make sure that we can request to the child, then kill it.
|
// now make sure that we can request to the subprocess, then kill it.
|
||||||
http.get({
|
http.get({
|
||||||
server: 'localhost',
|
server: 'localhost',
|
||||||
port: child.port,
|
port: child.port,
|
||||||
@ -64,7 +64,7 @@ function test() {
|
|||||||
s += c.toString();
|
s += c.toString();
|
||||||
});
|
});
|
||||||
res.on('end', function() {
|
res.on('end', function() {
|
||||||
// kill the child before we start doing asserts.
|
// kill the subprocess before we start doing asserts.
|
||||||
// it's really annoying when tests leave orphans!
|
// it's really annoying when tests leave orphans!
|
||||||
process.kill(child.pid, 'SIGKILL');
|
process.kill(child.pid, 'SIGKILL');
|
||||||
try {
|
try {
|
||||||
|
@ -44,7 +44,7 @@ process.on('exit', function() {
|
|||||||
// concurrency in HTTP servers! Use the cluster module, or if you want
|
// concurrency in HTTP servers! Use the cluster module, or if you want
|
||||||
// a more low-level approach, use child process IPC manually.
|
// a more low-level approach, use child process IPC manually.
|
||||||
test(function(child, port) {
|
test(function(child, port) {
|
||||||
// now make sure that we can request to the child, then kill it.
|
// now make sure that we can request to the subprocess, then kill it.
|
||||||
http.get({
|
http.get({
|
||||||
server: 'localhost',
|
server: 'localhost',
|
||||||
port: port,
|
port: port,
|
||||||
|
@ -58,8 +58,8 @@ if (process.argv[2] === 'child') {
|
|||||||
const child = fork(process.argv[1], ['child']);
|
const child = fork(process.argv[1], ['child']);
|
||||||
|
|
||||||
child.on('exit', function(code, signal) {
|
child.on('exit', function(code, signal) {
|
||||||
if (!childKilled)
|
if (!subprocessKilled)
|
||||||
throw new Error('child died unexpectedly!');
|
throw new Error('subprocess died unexpectedly!');
|
||||||
});
|
});
|
||||||
|
|
||||||
const server = net.createServer();
|
const server = net.createServer();
|
||||||
@ -86,10 +86,10 @@ if (process.argv[2] === 'child') {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let childKilled = false;
|
let subprocessKilled = false;
|
||||||
function closeSockets(i) {
|
function closeSockets(i) {
|
||||||
if (i === count) {
|
if (i === count) {
|
||||||
childKilled = true;
|
subprocessKilled = true;
|
||||||
server.close();
|
server.close();
|
||||||
child.kill();
|
child.kill();
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user