From 2923ed10bb6dd1d6a203e1a89d1aa179df5cf243 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 6 Aug 2017 19:47:32 -0700 Subject: [PATCH] test: improve check in test-os MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The check for `os.networkInterfaces()` in `test-os.js` may be too strict. It's apparently possible for a machine to be configured with multiple IPv4 loopback interfaces. Increase specificity of filter to check on only the object we expect. PR-URL: https://github.com/nodejs/node/pull/14655 Fixes: https://github.com/nodejs/node/issues/14654 Reviewed-By: Luigi Pinca Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: Refael Ackermann Reviewed-By: James M Snell --- test/parallel/test-os.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-os.js b/test/parallel/test-os.js index 09920ebbaa3..180d869001f 100644 --- a/test/parallel/test-os.js +++ b/test/parallel/test-os.js @@ -116,7 +116,8 @@ const interfaces = os.networkInterfaces(); switch (platform) { case 'linux': { - const filter = (e) => e.address === '127.0.0.1'; + const filter = + (e) => e.address === '127.0.0.1' && e.netmask === '255.0.0.0'; const actual = interfaces.lo.filter(filter); const expected = [{ address: '127.0.0.1', netmask: '255.0.0.0', mac: '00:00:00:00:00:00', family: 'IPv4',