test: remove common.PORT from test-net-pause

Switch test-net-pause 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>
This commit is contained in:
Rich Trott 2020-02-11 19:23:51 -08:00
parent a092886b1d
commit af19f4116c

View File

@ -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');
@ -43,7 +43,7 @@ const server = net.createServer((connection) => {
});
server.on('listening', () => {
const client = net.createConnection(common.PORT);
const client = net.createConnection(server.address().port);
client.setEncoding('ascii');
client.on('data', (d) => {
console.log(d);
@ -83,7 +83,7 @@ server.on('listening', () => {
client.end();
});
});
server.listen(common.PORT);
server.listen(0);
process.on('exit', () => {
assert.strictEqual(recv.length, N);