From 28b77d1f8be8a81a0ae53512be963707533ca046 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 db5a137eb54ef4..f3c0082f553c1d 100644 --- a/test/parallel/test-os.js +++ b/test/parallel/test-os.js @@ -104,7 +104,8 @@ console.error(interfaces); 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',