mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
test: avoid idle HTTP/HTTPS connections
Single-use requests otherwise wait for the keep-alive timeout. Use nonpersistent agents where agent selection is unrelated to coverage. For default-agent tests, close the server after consuming the response. Signed-off-by: Filip Skokan <panva.ip@gmail.com> Assisted-by: Codex PR-URL: https://github.com/nodejs/node/pull/65980 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name>
This commit is contained in:
1 parent
f5edf1cd7c
commit
625290573a
37 files changed
+45
-15
No files matched your search
@@ -45,7 +45,6 @@ const server = https.createServer(httpsOptions, function(request, response) {
|
||||
check(request);
|
||||
response.writeHead(200, {});
|
||||
response.end('ok');
|
||||
server.close();
|
||||
});
|
||||
|
||||
server.listen(0, common.mustCall(function() {
|
||||
@@ -57,5 +56,9 @@ server.listen(0, common.mustCall(function() {
|
||||
// Since there is a little magic with the agent
|
||||
// make sure that the request uses the https.Agent
|
||||
assert.ok(clientRequest.agent instanceof https.Agent);
|
||||
clientRequest.on('response', common.mustCall((response) => {
|
||||
response.on('end', common.mustCall(() => server.close()));
|
||||
response.resume();
|
||||
}));
|
||||
clientRequest.end();
|
||||
}));
|
||||
Reference in new issue
Block a user