Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

In test-os search all interfaces for loopback, fixes #3497.

  • Loading branch information...
commit d94e208b7a9117fe0498c4081c2e4b4d030c946c 1 parent fe464a2
Kevin Jones authored
Showing with 9 additions and 14 deletions.
  1. +9 −14 test/simple/test-os.js
View
23 test/simple/test-os.js
@@ -74,23 +74,18 @@ if (process.platform != 'sunos') {
assert.ok(os.totalmem() > 0);
}
-
+// Check for an IPv4 loopback
var interfaces = os.networkInterfaces();
console.error(interfaces);
-switch (platform) {
- case 'linux':
- var filter = function(e) { return e.address == '127.0.0.1'; };
- var actual = interfaces.lo.filter(filter);
- var expected = [{ address: '127.0.0.1', family: 'IPv4', internal: true }];
- assert.deepEqual(actual, expected);
- break;
- case 'win32':
- var filter = function(e) { return e.address == '127.0.0.1'; };
- var actual = interfaces['Loopback Pseudo-Interface 1'].filter(filter);
- var expected = [{ address: '127.0.0.1', family: 'IPv4', internal: true }];
- assert.deepEqual(actual, expected);
- break;
+var filter = function(e) { return e.address == '127.0.0.1'; };
+var expected = { address: '127.0.0.1', family: 'IPv4', internal: true };
+var address = function(a) { assert.deepEqual(a, expected); return true; };
+var count = 0;
+for (var i in interfaces) {
+ var addr=interfaces[i].filter(filter).filter(address);
+ count += addr.length;
}
+assert(count > 0);
var EOL = os.EOL;
assert.ok(EOL.length > 0);
Please sign in to comment.
Something went wrong with that request. Please try again.