Skip to content

Commit

Permalink
test: improve check in test-os
Browse files Browse the repository at this point in the history
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: #14654
  • Loading branch information
Trott committed Aug 7, 2017
1 parent daf5596 commit 6071f05
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/parallel/test-os.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 6071f05

Please sign in to comment.