test: rename regression tests more expressively
PR-URL: https://github.com/nodejs/node/pull/19495 Refs: https://github.com/nodejs/node/issues/19105 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Родитель
ca22c96f16
Коммит
eeb57022e6
|
@ -1,8 +1,11 @@
|
|||
'use strict';
|
||||
require('../common');
|
||||
|
||||
// This test ensures Math functions don't fail with an "illegal instruction"
|
||||
// error on ARM devices (primarily on the Raspberry Pi 1)
|
||||
// See https://github.com/nodejs/node/issues/1376
|
||||
// and https://code.google.com/p/v8/issues/detail?id=4019
|
||||
|
||||
require('../common');
|
||||
Math.abs(-0.5);
|
||||
Math.acos(-0.5);
|
||||
Math.acosh(-0.5);
|
|
@ -1,10 +1,13 @@
|
|||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
|
||||
// This test ensures that Node.js throws a RangeError when trying to convert a
|
||||
// gigantic buffer into a string.
|
||||
// Regression test for https://github.com/nodejs/node/issues/649.
|
||||
|
||||
const assert = require('assert');
|
||||
const SlowBuffer = require('buffer').SlowBuffer;
|
||||
|
||||
// Regression test for https://github.com/nodejs/node/issues/649.
|
||||
const len = 1422561062959;
|
||||
const message = common.expectsError({
|
||||
code: 'ERR_INVALID_OPT_VALUE',
|
|
@ -20,9 +20,12 @@
|
|||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
// Remove this test once we support sending strings.
|
||||
|
||||
require('../common');
|
||||
|
||||
// This test ensures that a TypeError is raised when the argument to `send()`
|
||||
// or `sendto()` is anything but a Buffer.
|
||||
// https://github.com/nodejs/node-v0.x-archive/issues/4496
|
||||
|
||||
const assert = require('assert');
|
||||
const dgram = require('dgram');
|
||||
|
|
@ -21,18 +21,25 @@
|
|||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
|
||||
// This test ensures `dns.resolveNs()` does not raise a C++-land assertion error
|
||||
// and throw a JavaScript TypeError instead.
|
||||
// Issue https://github.com/nodejs/node-v0.x-archive/issues/7070
|
||||
|
||||
const dns = require('dns');
|
||||
|
||||
// Should not raise assertion error.
|
||||
// Issue https://github.com/nodejs/node-v0.x-archive/issues/7070
|
||||
common.expectsError(() => dns.resolveNs([]), // bad name
|
||||
{
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
type: TypeError,
|
||||
message: /^The "name" argument must be of type string/
|
||||
});
|
||||
common.expectsError(() => dns.resolveNs(''), // bad callback
|
||||
{
|
||||
code: 'ERR_INVALID_CALLBACK',
|
||||
type: TypeError
|
||||
});
|
||||
common.expectsError(
|
||||
() => dns.resolveNs([]), // bad name
|
||||
{
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
type: TypeError,
|
||||
message: /^The "name" argument must be of type string/
|
||||
}
|
||||
);
|
||||
common.expectsError(
|
||||
() => dns.resolveNs(''), // bad callback
|
||||
{
|
||||
code: 'ERR_INVALID_CALLBACK',
|
||||
type: TypeError
|
||||
}
|
||||
);
|
|
@ -1,41 +0,0 @@
|
|||
'use strict';
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const http = require('http');
|
||||
const Countdown = require('../common/countdown');
|
||||
|
||||
const MAX_SOCKETS = 2;
|
||||
|
||||
const agent = new http.Agent({
|
||||
keepAlive: true,
|
||||
keepAliveMsecs: 1000,
|
||||
maxSockets: MAX_SOCKETS,
|
||||
maxFreeSockets: 2
|
||||
});
|
||||
|
||||
const server = http.createServer(common.mustCall((req, res) => {
|
||||
res.end('hello world');
|
||||
}, 6));
|
||||
|
||||
const countdown = new Countdown(6, () => server.close());
|
||||
|
||||
function get(path, callback) {
|
||||
return http.get({
|
||||
host: 'localhost',
|
||||
port: server.address().port,
|
||||
agent: agent,
|
||||
path: path
|
||||
}, callback);
|
||||
}
|
||||
|
||||
server.listen(0, common.mustCall(() => {
|
||||
for (let i = 0; i < 6; i++) {
|
||||
const request = get('/1', common.mustCall());
|
||||
request.on('response', common.mustCall(() => {
|
||||
request.abort();
|
||||
const sockets = agent.sockets[Object.keys(agent.sockets)[0]];
|
||||
assert(sockets.length <= MAX_SOCKETS);
|
||||
countdown.dec();
|
||||
}));
|
||||
}
|
||||
}));
|
|
@ -0,0 +1,56 @@
|
|||
'use strict';
|
||||
const common = require('../common');
|
||||
const Countdown = require('../common/countdown');
|
||||
|
||||
// This test ensures that the `maxSockets` value for `http.Agent` is respected.
|
||||
// https://github.com/nodejs/node/issues/4050
|
||||
|
||||
const assert = require('assert');
|
||||
const http = require('http');
|
||||
|
||||
const MAX_SOCKETS = 2;
|
||||
|
||||
const agent = new http.Agent({
|
||||
keepAlive: true,
|
||||
keepAliveMsecs: 1000,
|
||||
maxSockets: MAX_SOCKETS,
|
||||
maxFreeSockets: 2
|
||||
});
|
||||
|
||||
const server = http.createServer(
|
||||
common.mustCall((req, res) => {
|
||||
res.end('hello world');
|
||||
}, 6)
|
||||
);
|
||||
|
||||
const countdown = new Countdown(6, () => server.close());
|
||||
|
||||
function get(path, callback) {
|
||||
return http.get(
|
||||
{
|
||||
host: 'localhost',
|
||||
port: server.address().port,
|
||||
agent: agent,
|
||||
path: path
|
||||
},
|
||||
callback
|
||||
);
|
||||
}
|
||||
|
||||
server.listen(
|
||||
0,
|
||||
common.mustCall(() => {
|
||||
for (let i = 0; i < 6; i++) {
|
||||
const request = get('/1', common.mustCall());
|
||||
request.on(
|
||||
'response',
|
||||
common.mustCall(() => {
|
||||
request.abort();
|
||||
const sockets = agent.sockets[Object.keys(agent.sockets)[0]];
|
||||
assert(sockets.length <= MAX_SOCKETS);
|
||||
countdown.dec();
|
||||
})
|
||||
);
|
||||
}
|
||||
})
|
||||
);
|
Загрузка…
Ссылка в новой задаче