From ea944a36b1785e5d5b6181474dc50847f1826402 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Mon, 4 Jul 2022 10:50:13 -0700 Subject: [PATCH] tests: fix test failures with node v19 change to default http clients to use keep-alive As of https://github.com/nodejs/node/issues/37184 node v19 and later defaults the http,https.globalAgent to use keep-alive: - globalAgent: new Agent() + globalAgent: new Agent({ keepAlive: true, scheduling: 'lifo', timeout: 5000 }) This change in default broke a couple tests. The agent itself is unaffected because our http client already uses a custom http agent using keep-alive. --- test/instrumentation/modules/http2.test.js | 1 + test/parsers.test.js | 1 + 2 files changed, 2 insertions(+) diff --git a/test/instrumentation/modules/http2.test.js b/test/instrumentation/modules/http2.test.js index 949af262cc..13d475c584 100644 --- a/test/instrumentation/modules/http2.test.js +++ b/test/instrumentation/modules/http2.test.js @@ -455,6 +455,7 @@ test('handling HTTP/1.1 request to http2.createSecureServer with allowHTTP1:true // Make an HTTP/1.1 request. var getOpts = { + agent: new https.Agent(), protocol: 'https:', host: 'localhost', port: port, diff --git a/test/parsers.test.js b/test/parsers.test.js index 2b80cba93d..4abe20b86f 100644 --- a/test/parsers.test.js +++ b/test/parsers.test.js @@ -239,6 +239,7 @@ function onRequest (cb) { server.listen(function () { var opts = { + agent: new http.Agent(), port: server.address().port } var req = http.request(opts, function (res) {