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 <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Anna Henningsen 2019-06-19 19:30:30 -07:00 committed by Rich Trott
parent d9da0a9912
commit bf7edaa3c9

View File

@ -47,10 +47,9 @@ const server = http.createServer((req, res) => {
res.end(); res.end();
}); });
const PORT = 3000; server.listen(0, common.mustCall(() => {
const url = `http://127.0.0.1:${PORT}`; const PORT = server.address().port;
const url = `http://127.0.0.1:${PORT}`;
server.listen(PORT, common.mustCall(() => {
http.get(url, common.mustCall(() => { http.get(url, common.mustCall(() => {
server.close(common.mustCall(() => { server.close(common.mustCall(() => {
server.listen(PORT, common.mustCall(() => { server.listen(PORT, common.mustCall(() => {