diff options
author | Rich Trott <rtrott@gmail.com> | 2019-01-28 02:21:04 -0800 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-01-30 07:53:12 -0800 |
commit | 86a49ce2d8870e37089e3450addb05737ae01d70 (patch) | |
tree | fb70d1c1964cc04de049e8e7573edb1f60c91ecb | |
parent | 5e1d4462d232400b4e75247540aae863cb6877cf (diff) | |
download | node-new-86a49ce2d8870e37089e3450addb05737ae01d70.tar.gz |
test: move client renegotiation tests to parallel
* Move client renegotiation limit tests from pummel to parallel.
* Rename tests to more accurately reflect what they do.
* Refactor to use arrow functions for anonymouse callbacks and to be
consistent about trailing commas.
PR-URL: https://github.com/nodejs/node/pull/25757
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
-rw-r--r-- | test/parallel/test-https-client-renegotiation-limit.js (renamed from test/pummel/test-https-ci-reneg-attack.js) | 14 | ||||
-rw-r--r-- | test/parallel/test-tls-client-renegotiation-limit.js (renamed from test/pummel/test-tls-ci-reneg-attack.js) | 16 |
2 files changed, 15 insertions, 15 deletions
diff --git a/test/pummel/test-https-ci-reneg-attack.js b/test/parallel/test-https-client-renegotiation-limit.js index 592dd68273..1fccc7bb5d 100644 --- a/test/pummel/test-https-ci-reneg-attack.js +++ b/test/parallel/test-https-client-renegotiation-limit.js @@ -48,12 +48,12 @@ const LIMITS = [0, 1, 2, 3, 5, 10, 16]; function test(next) { const options = { cert: fixtures.readSync('test_cert.pem'), - key: fixtures.readSync('test_key.pem') + key: fixtures.readSync('test_key.pem'), }; - const server = https.createServer(options, function(req, res) { + const server = https.createServer(options, (req, res) => { const conn = req.connection; - conn.on('error', function(err) { + conn.on('error', (err) => { console.error(`Caught exception: ${err}`); assert(/TLS session renegotiation attack/.test(err)); conn.destroy(); @@ -61,7 +61,7 @@ function test(next) { res.end('ok'); }); - server.listen(0, function() { + server.listen(0, () => { const agent = https.Agent({ keepAlive: true, }); @@ -71,7 +71,7 @@ function test(next) { const options = { rejectUnauthorized: false, - agent + agent, }; const { port } = server.address(); @@ -79,14 +79,14 @@ function test(next) { https.get(`https://localhost:${port}/`, options, (res) => { client = res.socket; - client.on('close', function(hadErr) { + client.on('close', (hadErr) => { assert.strictEqual(hadErr, false); assert.strictEqual(renegs, tls.CLIENT_RENEG_LIMIT + 1); server.close(); process.nextTick(next); }); - client.on('error', function(err) { + client.on('error', (err) => { console.log('CLIENT ERR', err); throw err; }); diff --git a/test/pummel/test-tls-ci-reneg-attack.js b/test/parallel/test-tls-client-renegotiation-limit.js index 558efdbdec..daae92eeb4 100644 --- a/test/pummel/test-tls-ci-reneg-attack.js +++ b/test/parallel/test-tls-client-renegotiation-limit.js @@ -47,11 +47,11 @@ const LIMITS = [0, 1, 2, 3, 5, 10, 16]; function test(next) { const options = { cert: fixtures.readSync('test_cert.pem'), - key: fixtures.readSync('test_key.pem') + key: fixtures.readSync('test_key.pem'), }; - const server = tls.createServer(options, function(conn) { - conn.on('error', function(err) { + const server = tls.createServer(options, (conn) => { + conn.on('error', (err) => { console.error(`Caught exception: ${err}`); assert(/TLS session renegotiation attack/.test(err)); conn.destroy(); @@ -59,28 +59,28 @@ function test(next) { conn.pipe(conn); }); - server.listen(0, function() { + server.listen(0, () => { const options = { host: server.address().host, port: server.address().port, - rejectUnauthorized: false + rejectUnauthorized: false, }; const client = tls.connect(options, spam); let renegs = 0; - client.on('close', function() { + client.on('close', () => { assert.strictEqual(renegs, tls.CLIENT_RENEG_LIMIT + 1); server.close(); process.nextTick(next); }); - client.on('error', function(err) { + client.on('error', (err) => { console.log('CLIENT ERR', err); throw err; }); - client.on('close', function(hadErr) { + client.on('close', (hadErr) => { assert.strictEqual(hadErr, false); }); |