Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: rename regression tests with descriptive file names (pt. 6) #19608

Closed
wants to merge 1 commit into from
Closed
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
55 changes: 0 additions & 55 deletions test/parallel/test-async-wrap-GH13045.js

This file was deleted.

66 changes: 66 additions & 0 deletions test/parallel/test-async-wrap-tlssocket-asyncreset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
'use strict';
const common = require('../common');
if (!common.hasCrypto) common.skip('missing crypto');
const fixtures = require('../common/fixtures');

// An HTTP Agent reuses a TLSSocket, and makes a failed call to `asyncReset`.
// Refs: https://github.com/nodejs/node/issues/13045

const assert = require('assert');
const https = require('https');

const serverOptions = {
key: fixtures.readKey('agent1-key.pem'),
cert: fixtures.readKey('agent1-cert.pem'),
ca: fixtures.readKey('ca1-cert.pem')
};

const server = https.createServer(
serverOptions,
common.mustCall((req, res) => {
res.end('hello world\n');
}, 2)
);

server.listen(
0,
common.mustCall(function() {
const port = this.address().port;
const clientOptions = {
agent: new https.Agent({
keepAlive: true,
rejectUnauthorized: false
}),
port: port
};

const req = https.get(
clientOptions,
common.mustCall((res) => {
assert.strictEqual(res.statusCode, 200);
res.on('error', (err) => assert.fail(err));
res.socket.on('error', (err) => assert.fail(err));
res.resume();
// drain the socket and wait for it to be free to reuse
res.socket.once('free', () => {
// This is the pain point. Internally the Agent will call
// `socket._handle.asyncReset()` and if the _handle does not implement
// `asyncReset` this will throw TypeError
const req2 = https.get(
clientOptions,
common.mustCall((res2) => {
assert.strictEqual(res.statusCode, 200);
res2.on('error', (err) => assert.fail(err));
res2.socket.on('error', (err) => assert.fail(err));
// this should be the end of the test
res2.destroy();
server.close();
})
);
req2.on('error', (err) => assert.fail(err));
});
})
);
req.on('error', (err) => assert.fail(err));
})
);
75 changes: 75 additions & 0 deletions test/parallel/test-child-process-fork-closed-channel-segfault.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
'use strict';
const common = require('../common');

// Before https://github.com/nodejs/node/pull/2847 a child process trying
// (asynchronously) to use the closed channel to it's creator caused a segfault.

const assert = require('assert');
const cluster = require('cluster');
const net = require('net');

if (!cluster.isMaster) {
// Exit on first received handle to leave the queue non-empty in master
process.on('message', function() {
process.exit(1);
});
return;
}

const server = net
.createServer(function(s) {
if (common.isWindows) {
s.on('error', function(err) {
// Prevent possible ECONNRESET errors from popping up
if (err.code !== 'ECONNRESET') throw err;
});
}
setTimeout(function() {
s.destroy();
}, 100);
})
.listen(0, function() {
const worker = cluster.fork();

function send(callback) {
const s = net.connect(server.address().port, function() {
worker.send({}, s, callback);
});

// https://github.com/nodejs/node/issues/3635#issuecomment-157714683
// ECONNREFUSED or ECONNRESET errors can happen if this connection is
// still establishing while the server has already closed.
// EMFILE can happen if the worker __and__ the server had already closed.
s.on('error', function(err) {
if (
err.code !== 'ECONNRESET' &&
err.code !== 'ECONNREFUSED' &&
err.code !== 'EMFILE'
) {
throw err;
}
});
}

worker.process.once(
'close',
common.mustCall(function() {
// Otherwise the crash on `channel.fd` access may happen
assert.strictEqual(worker.process.channel, null);
server.close();
})
);

worker.on('online', function() {
send(function(err) {
assert.ifError(err);
send(function(err) {
// Ignore errors when sending the second handle because the worker
// may already have exited.
if (err && err.message !== 'Channel closed') {
throw err;
}
});
});
});
});
69 changes: 0 additions & 69 deletions test/parallel/test-child-process-fork-regr-gh-2847.js

This file was deleted.

34 changes: 34 additions & 0 deletions test/parallel/test-http-pipeline-assertionerror-finish.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'use strict';
const common = require('../common');

// This test ensures that Node.js doesn't crash with an AssertionError at
// `ServerResponse.resOnFinish` because of an out-of-order 'finish' bug in
// pipelining.
// https://github.com/nodejs/node/issues/2639

const http = require('http');
const net = require('net');

const COUNT = 10;

const server = http
.createServer(
common.mustCall((req, res) => {
// Close the server, we have only one TCP connection anyway
server.close();
res.writeHead(200);
res.write('data');

setTimeout(function() {
res.end();
}, (Math.random() * 100) | 0);
}, COUNT)
)
.listen(0, function() {
const s = net.connect(this.address().port);

const big = 'GET / HTTP/1.0\r\n\r\n'.repeat(COUNT);

s.write(big);
s.resume();
});
24 changes: 0 additions & 24 deletions test/parallel/test-http-pipeline-regr-2639.js

This file was deleted.

27 changes: 0 additions & 27 deletions test/parallel/test-http-pipeline-regr-3332.js

This file was deleted.

Loading