From bf7edaa3c9075b58352a618f1a60785a481902f7 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 19 Jun 2019 19:30:30 -0700 Subject: [PATCH] test: do not use fixed port in async-hooks/test-httparser-reuse Otherwise this was failing on machines which already had a service running on port 3000. PR-URL: https://github.com/nodejs/node/pull/28312 Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott Reviewed-By: James M Snell --- test/async-hooks/test-httparser-reuse.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/async-hooks/test-httparser-reuse.js b/test/async-hooks/test-httparser-reuse.js index 06441562e05aa8..70248970df364c 100644 --- a/test/async-hooks/test-httparser-reuse.js +++ b/test/async-hooks/test-httparser-reuse.js @@ -47,10 +47,9 @@ const server = http.createServer((req, res) => { res.end(); }); -const PORT = 3000; -const url = `http://127.0.0.1:${PORT}`; - -server.listen(PORT, common.mustCall(() => { +server.listen(0, common.mustCall(() => { + const PORT = server.address().port; + const url = `http://127.0.0.1:${PORT}`; http.get(url, common.mustCall(() => { server.close(common.mustCall(() => { server.listen(PORT, common.mustCall(() => {