summaryrefslogtreecommitdiff
path: root/test/pummel
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2020-02-11 19:18:27 -0800
committerShelley Vohr <shelley.vohr@gmail.com>2020-03-30 10:59:53 -0700
commit33d3cccb98c6165c3f926411161ed40c7d7ad21c (patch)
treea35fb0970a8b2b95008e149545533ad1cd63ac75 /test/pummel
parentd172cc1474904e8a8c9765cd70ee658b5219ce8b (diff)
downloadnode-new-33d3cccb98c6165c3f926411161ed40c7d7ad21c.tar.gz
test: remove common.PORT from test-net-throttle
Switch test-net-throttle from common.PORT to a port assigned by the operating system. PR-URL: https://github.com/nodejs/node/pull/31749 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'test/pummel')
-rw-r--r--test/pummel/test-net-throttle.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/pummel/test-net-throttle.js b/test/pummel/test-net-throttle.js
index 190c242d6e..9708d69f96 100644
--- a/test/pummel/test-net-throttle.js
+++ b/test/pummel/test-net-throttle.js
@@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';
-const common = require('../common');
+require('../common');
const assert = require('assert');
const net = require('net');
@@ -32,8 +32,6 @@ let npauses = 0;
console.log('build big string');
const body = 'C'.repeat(N);
-console.log(`start server on port ${common.PORT}`);
-
const server = net.createServer((connection) => {
connection.write(body.slice(0, part_N));
connection.write(body.slice(part_N, 2 * part_N));
@@ -44,9 +42,11 @@ const server = net.createServer((connection) => {
connection.end();
});
-server.listen(common.PORT, () => {
+server.listen(0, () => {
+ const port = server.address().port;
+ console.log(`server started on port ${port}`);
let paused = false;
- const client = net.createConnection(common.PORT);
+ const client = net.createConnection(port);
client.setEncoding('ascii');
client.on('data', (d) => {
chars_recved += d.length;