Browse Source

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.

PR-URL: https://github.com/nodejs/node/pull/14655
Fixes: https://github.com/nodejs/node/issues/14654
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6.x
Rich Trott 7 years ago
committed by Myles Borins
parent
commit
28b77d1f8b
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 3
      test/parallel/test-os.js

3
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',

Loading…
Cancel
Save