Skip to content

Commit 40be64d

Browse files
ryzokukentargos
authored andcommitted
test: rename regression tests more expressively
PR-URL: #19495 Refs: #19105 Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 0310df8 commit 40be64d

6 files changed

+90
-59
lines changed

test/parallel/test-arm-math-exp-regress-1376.js test/parallel/test-arm-math-illegal-instruction.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
'use strict';
2+
require('../common');
3+
4+
// This test ensures Math functions don't fail with an "illegal instruction"
5+
// error on ARM devices (primarily on the Raspberry Pi 1)
26
// See https://github.com/nodejs/node/issues/1376
37
// and https://code.google.com/p/v8/issues/detail?id=4019
48

5-
require('../common');
69
Math.abs(-0.5);
710
Math.acos(-0.5);
811
Math.acosh(-0.5);

test/parallel/test-buffer-regression-649.js test/parallel/test-buffer-tostring-rangeerror.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
'use strict';
2-
32
const common = require('../common');
3+
4+
// This test ensures that Node.js throws a RangeError when trying to convert a
5+
// gigantic buffer into a string.
6+
// Regression test for https://github.com/nodejs/node/issues/649.
7+
48
const assert = require('assert');
59
const SlowBuffer = require('buffer').SlowBuffer;
610

7-
// Regression test for https://github.com/nodejs/node/issues/649.
811
const len = 1422561062959;
912
const message = common.expectsError({
1013
code: 'ERR_INVALID_OPT_VALUE',

test/parallel/test-dgram-regress-4496.js test/parallel/test-dgram-send-invalid-msg-type.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

2222
'use strict';
23-
// Remove this test once we support sending strings.
24-
2523
require('../common');
24+
25+
// This test ensures that a TypeError is raised when the argument to `send()`
26+
// or `sendto()` is anything but a Buffer.
27+
// https://github.com/nodejs/node-v0.x-archive/issues/4496
28+
2629
const assert = require('assert');
2730
const dgram = require('dgram');
2831

test/parallel/test-dns-regress-7070.js test/parallel/test-dns-resolvens-typeerror.js

+20-13
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,25 @@
2121

2222
'use strict';
2323
const common = require('../common');
24-
const dns = require('dns');
2524

26-
// Should not raise assertion error.
25+
// This test ensures `dns.resolveNs()` does not raise a C++-land assertion error
26+
// and throw a JavaScript TypeError instead.
2727
// Issue https://github.com/nodejs/node-v0.x-archive/issues/7070
28-
common.expectsError(() => dns.resolveNs([]), // bad name
29-
{
30-
code: 'ERR_INVALID_ARG_TYPE',
31-
type: TypeError,
32-
message: /^The "name" argument must be of type string/
33-
});
34-
common.expectsError(() => dns.resolveNs(''), // bad callback
35-
{
36-
code: 'ERR_INVALID_CALLBACK',
37-
type: TypeError
38-
});
28+
29+
const dns = require('dns');
30+
31+
common.expectsError(
32+
() => dns.resolveNs([]), // bad name
33+
{
34+
code: 'ERR_INVALID_ARG_TYPE',
35+
type: TypeError,
36+
message: /^The "name" argument must be of type string/
37+
}
38+
);
39+
common.expectsError(
40+
() => dns.resolveNs(''), // bad callback
41+
{
42+
code: 'ERR_INVALID_CALLBACK',
43+
type: TypeError
44+
}
45+
);

test/parallel/test-http-agent-maxsockets-regress-4050.js

-41
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
'use strict';
2+
const common = require('../common');
3+
const Countdown = require('../common/countdown');
4+
5+
// This test ensures that the `maxSockets` value for `http.Agent` is respected.
6+
// https://github.com/nodejs/node/issues/4050
7+
8+
const assert = require('assert');
9+
const http = require('http');
10+
11+
const MAX_SOCKETS = 2;
12+
13+
const agent = new http.Agent({
14+
keepAlive: true,
15+
keepAliveMsecs: 1000,
16+
maxSockets: MAX_SOCKETS,
17+
maxFreeSockets: 2
18+
});
19+
20+
const server = http.createServer(
21+
common.mustCall((req, res) => {
22+
res.end('hello world');
23+
}, 6)
24+
);
25+
26+
const countdown = new Countdown(6, () => server.close());
27+
28+
function get(path, callback) {
29+
return http.get(
30+
{
31+
host: 'localhost',
32+
port: server.address().port,
33+
agent: agent,
34+
path: path
35+
},
36+
callback
37+
);
38+
}
39+
40+
server.listen(
41+
0,
42+
common.mustCall(() => {
43+
for (let i = 0; i < 6; i++) {
44+
const request = get('/1', common.mustCall());
45+
request.on(
46+
'response',
47+
common.mustCall(() => {
48+
request.abort();
49+
const sockets = agent.sockets[Object.keys(agent.sockets)[0]];
50+
assert(sockets.length <= MAX_SOCKETS);
51+
countdown.dec();
52+
})
53+
);
54+
}
55+
})
56+
);

0 commit comments

Comments
 (0)