Skip to content

Commit

Permalink
tests: fix test failures with node v19 change to default http clients…
Browse files Browse the repository at this point in the history
… to use keep-alive

As of nodejs/node#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.
  • Loading branch information
trentm committed Jul 4, 2022
1 parent 9e1f604 commit ea944a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/instrumentation/modules/http2.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions test/parsers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ea944a3

Please sign in to comment.