mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
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:
parent
a092886b1d
commit
af19f4116c
@ -20,7 +20,7 @@
|
|||||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const net = require('net');
|
const net = require('net');
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ const server = net.createServer((connection) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
server.on('listening', () => {
|
server.on('listening', () => {
|
||||||
const client = net.createConnection(common.PORT);
|
const client = net.createConnection(server.address().port);
|
||||||
client.setEncoding('ascii');
|
client.setEncoding('ascii');
|
||||||
client.on('data', (d) => {
|
client.on('data', (d) => {
|
||||||
console.log(d);
|
console.log(d);
|
||||||
@ -83,7 +83,7 @@ server.on('listening', () => {
|
|||||||
client.end();
|
client.end();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
server.listen(common.PORT);
|
server.listen(0);
|
||||||
|
|
||||||
process.on('exit', () => {
|
process.on('exit', () => {
|
||||||
assert.strictEqual(recv.length, N);
|
assert.strictEqual(recv.length, N);
|
||||||
|
Loading…
Reference in New Issue
Block a user