Permalink
Browse files

test: use invalid host according to RFC2606

PR-URL: #14863
Refs: #14781
Refs: https://tools.ietf.org/html/rfc2606#section-2
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
  • Loading branch information...
tniessen committed Aug 16, 2017
1 parent fd8cf79 commit 467385a49b659b704973b8195328775b620ae6ab
Showing with 10 additions and 10 deletions.
  1. +8 −8 test/internet/test-dns.js
  2. +2 −2 test/parallel/test-http-client-req-error-dont-double-fire.js
View
@@ -388,12 +388,12 @@ TEST(function test_resolveTxt_failure(done) {
TEST(function test_lookup_failure(done) {
const req = dns.lookup('does.not.exist', 4, function(err, ip, family) {
const req = dns.lookup('this.hostname.is.invalid', 4, (err, ip, family) => {
assert.ok(err instanceof Error);
assert.strictEqual(err.errno, dns.NOTFOUND);
assert.strictEqual(err.errno, 'ENOTFOUND');
assert.ok(!/ENOENT/.test(err.message));
assert.ok(/does\.not\.exist/.test(err.message));
assert.ok(err.message.includes('this.hostname.is.invalid'));
done();
});
@@ -511,11 +511,11 @@ TEST(function test_reverse_failure(done) {
TEST(function test_lookup_failure(done) {
const req = dns.lookup('nosuchhostimsure', function(err) {
const req = dns.lookup('this.hostname.is.invalid', (err) => {
assert(err instanceof Error);
assert.strictEqual(err.code, 'ENOTFOUND'); // Silly error code...
assert.strictEqual(err.hostname, 'nosuchhostimsure');
assert.ok(/nosuchhostimsure/.test(err.message));
assert.strictEqual(err.hostname, 'this.hostname.is.invalid');
assert.ok(err.message.includes('this.hostname.is.invalid'));
done();
});
@@ -525,7 +525,7 @@ TEST(function test_lookup_failure(done) {
TEST(function test_resolve_failure(done) {
const req = dns.resolve4('nosuchhostimsure', function(err) {
const req = dns.resolve4('this.hostname.is.invalid', (err) => {
assert(err instanceof Error);
switch (err.code) {
@@ -537,8 +537,8 @@ TEST(function test_resolve_failure(done) {
break;
}
assert.strictEqual(err.hostname, 'nosuchhostimsure');
assert.ok(/nosuchhostimsure/.test(err.message));
assert.strictEqual(err.hostname, 'this.hostname.is.invalid');
assert.ok(err.message.includes('this.hostname.is.invalid'));
done();
});
@@ -3,8 +3,8 @@ const assert = require('assert');
const http = require('http');
const common = require('../common');
// not exists host
const host = '*'.repeat(256);
// Invalid hostname as per https://tools.ietf.org/html/rfc2606#section-2
const host = 'this.hostname.is.invalid';
const req = http.get({ host });
const err = new Error('mock unexpected code error');
req.on('error', common.mustCall(() => {

0 comments on commit 467385a

Please sign in to comment.