From 1e4d053e6b94dfdcd6c81341445308db2588f916 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Wed, 20 Apr 2016 20:41:46 -0400 Subject: [PATCH] test: don't assume IPv6 in test-regress-GH-5727 test/parallel/test-regress-GH-5727 assumed that one of the servers would be listening on IPv6. This breaks when the machine running the test doesn't have IPv6. This commit builds the connection key that is compared dynamically. Refs: https://github.com/nodejs/node/pull/5732 PR-URL: https://github.com/nodejs/node/pull/6319 Reviewed-By: Rich Trott Reviewed-By: James M Snell Reviewed-By: Santiago Gimeno Reviewed-By: Fedor Indutny --- test/parallel/test-regress-GH-5727.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-regress-GH-5727.js b/test/parallel/test-regress-GH-5727.js index d481f702ed1b3f..ae8cca9cbf3338 100644 --- a/test/parallel/test-regress-GH-5727.js +++ b/test/parallel/test-regress-GH-5727.js @@ -7,7 +7,10 @@ const invalidPort = -1 >>> 0; const errorMessage = /"port" argument must be \>= 0 and \< 65536/; net.Server().listen(common.PORT, function() { - assert.equal(this._connectionKey, '6::::' + common.PORT); + const address = this.address(); + const key = `${address.family.slice(-1)}:${address.address}:${common.PORT}`; + + assert.equal(this._connectionKey, key); this.close(); });