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>
This commit is contained in:
parent
7ec28a0a50
commit
2923ed10bb
@ -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',
|
||||
|
Loading…
x
Reference in New Issue
Block a user