Skip to content

Commit

Permalink
test: improve dns internet test case
Browse files Browse the repository at this point in the history
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: #13261
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
mscdex authored and jasnell committed Jun 5, 2017
1 parent 315c3aa commit dccd1d2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/internet/test-dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down

0 comments on commit dccd1d2

Please sign in to comment.