Skip to content

Commit 28b77d1

Browse files
TrottMylesBorins
authored andcommitted
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: #14655 Fixes: #14654 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent fc49cf4 commit 28b77d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/parallel/test-os.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ console.error(interfaces);
104104
switch (platform) {
105105
case 'linux':
106106
{
107-
const filter = (e) => e.address === '127.0.0.1';
107+
const filter =
108+
(e) => e.address === '127.0.0.1' && e.netmask === '255.0.0.0';
108109
const actual = interfaces.lo.filter(filter);
109110
const expected = [{ address: '127.0.0.1', netmask: '255.0.0.0',
110111
mac: '00:00:00:00:00:00', family: 'IPv4',

0 commit comments

Comments
 (0)