From 6071f05c96d2a7667b99ffb105cb159b035cb95c 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 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. Fixes: https://github.com/nodejs/node/issues/14654 --- 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 09920ebbaa33d4..180d869001f5a6 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',