From 02e45558229def575f9e73f65b4aa645ec4b7a28 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 30 Jun 2018 01:55:20 +0200 Subject: [PATCH] test: add http2/tls destroy regression test Test part of 0c25cdf39a40a94fcb829ea91caa217d640054b1, specifically for v8.x. PR-URL: https://github.com/nodejs/node/pull/21598 Reviewed-By: Myles Borins --- test/parallel/test-http2-tls-disconnect.js | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 test/parallel/test-http2-tls-disconnect.js diff --git a/test/parallel/test-http2-tls-disconnect.js b/test/parallel/test-http2-tls-disconnect.js new file mode 100644 index 00000000000000..2e635fe1376a51 --- /dev/null +++ b/test/parallel/test-http2-tls-disconnect.js @@ -0,0 +1,32 @@ +'use strict'; +const common = require('../common'); +const fixtures = require('../common/fixtures'); + +if (!common.hasCrypto) + common.skip('missing crypto'); + +const child_process = require('child_process'); +const http2 = require('http2'); +const fs = require('fs'); + +const key = fixtures.readKey('agent8-key.pem', 'binary'); +const cert = fixtures.readKey('agent8-cert.pem', 'binary'); + +const server = http2.createSecureServer({ key, cert }, (request, response) => { + fs.createReadStream(process.execPath).pipe(response); +}); + +// This should be doable with a reproduction purely written in Node; +// that just requires somebody to take the time and actually do it. +server.listen(0, () => { + const proc = child_process.spawn('h2load', [ + '-n', '1000', + `https://localhost:${server.address().port}/` + ]); + proc.on('error', (err) => { + if (err.code === 'ENOENT') + common.skip('no h2load'); + }); + proc.on('exit', () => server.close()); + setTimeout(() => proc.kill(2), 100); +});