Skip to content

Commit d172cc1

Browse files
Trottcodebytere
authored andcommitted
test: remove common.PORT from test-net-timeout
Switch test-net-timeout 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 17882ac commit d172cc1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 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

@@ -54,10 +54,11 @@ const echo_server = net.createServer((socket) =>{
5454
});
5555
});
5656

57-
echo_server.listen(common.PORT,()=>{
58-
console.log(`server listening at ${common.PORT}`);
57+
echo_server.listen(0,()=>{
58+
constport=echo_server.address().port;
59+
console.log(`server listening at ${port}`);
5960

60-
constclient=net.createConnection(common.PORT);
61+
constclient=net.createConnection(port);
6162
client.setEncoding('UTF8');
6263
client.setTimeout(0);// Disable the timeout for client
6364
client.on('connect',()=>{

0 commit comments

Comments
(0)