From e7966bcb805f7b01d630cb14e15a199c4cd03293 Mon Sep 17 00:00:00 2001 From: MurkyMeow Date: Sun, 26 May 2019 22:50:24 +0900 Subject: [PATCH] test: unhardcode server port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is needed to avoid possible conflicts when running multiple tests in parallel PR-URL: https://github.com/nodejs/node/pull/27908 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Сковорода Никита Андреевич Reviewed-By: Ujjwal Sharma Reviewed-By: Rich Trott Reviewed-By: Gireesh Punathil --- .../parallel/test-http-server-delete-parser.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/parallel/test-http-server-delete-parser.js b/test/parallel/test-http-server-delete-parser.js index 0c5eea90734170..4215ee2f9df74e 100644 --- a/test/parallel/test-http-server-delete-parser.js +++ b/test/parallel/test-http-server-delete-parser.js @@ -12,13 +12,13 @@ const server = http.createServer(common.mustCall((req, res) => { res.end(); })); -server.listen(1337, '127.0.0.1'); -server.unref(); - -const req = http.request({ - port: 1337, - host: '127.0.0.1', - method: 'GET', -}); +server.listen(0, '127.0.0.1', common.mustCall(() => { + const req = http.request({ + port: server.address().port, + host: '127.0.0.1', + method: 'GET', + }); + req.end(); +})); -req.end(); +server.unref();