Skip to content

Commit 33d3ccc

Browse files
Trottcodebytere
authored andcommitted
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: #31749 Reviewed-By: Denys Otrishko <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent d172cc1 commit 33d3ccc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎test/pummel/test-net-throttle.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

2222
'use strict';
23-
constcommon=require('../common');
23+
require('../common');
2424
constassert=require('assert');
2525
constnet=require('net');
2626

@@ -32,8 +32,6 @@ let npauses = 0;
3232
console.log('build big string');
3333
constbody='C'.repeat(N);
3434

35-
console.log(`start server on port ${common.PORT}`);
36-
3735
constserver=net.createServer((connection)=>{
3836
connection.write(body.slice(0,part_N));
3937
connection.write(body.slice(part_N,2*part_N));
@@ -44,9 +42,11 @@ const server = net.createServer((connection) =>{
4442
connection.end();
4543
});
4644

47-
server.listen(common.PORT,()=>{
45+
server.listen(0,()=>{
46+
constport=server.address().port;
47+
console.log(`server started on port ${port}`);
4848
letpaused=false;
49-
constclient=net.createConnection(common.PORT);
49+
constclient=net.createConnection(port);
5050
client.setEncoding('ascii');
5151
client.on('data',(d)=>{
5252
chars_recved+=d.length;

0 commit comments

Comments
(0)