test: improve dns internet test case

0.0.0.0 is more common than other special ipv4 addresses, so
it is possible that we may not get ENOTFOUND for such addresses.
Instead, this commit uses a less common address that is reserved
for documentation (RFC) use only.

PR-URL: https://github.com/nodejs/node/pull/13261
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Brian White committed 2017-06-01 21:59:57 -04:00
1 parent 95eef9b044
commit 8d7ff6dd75
1 file changed
+4 -3
+4 -3
View File
@@ -492,11 +492,12 @@ TEST(function test_lookupservice_invalid(done) {
TEST(function test_reverse_failure(done) {
const req = dns.reverse('0.0.0.0', function(err) {
// 203.0.113.0/24 are addresses reserved for (RFC) documentation use only
const req = dns.reverse('203.0.113.0', function(err) {
assert(err instanceof Error);
assert.strictEqual(err.code, 'ENOTFOUND'); // Silly error code...
assert.strictEqual(err.hostname, '0.0.0.0');
assert.ok(/0\.0\.0\.0/.test(err.message));
assert.strictEqual(err.hostname, '203.0.113.0');
assert.ok(/203\.0\.113\.0/.test(err.message));
done();
});