Subject: | DNS resolver set to search a domain with wildcard DNS makes several tests fail |
These two patches should make it possible to detect if the system has a
misconfigured DNS setup and skip the live tests.
I might suggest to actually bail out instead of just skipping, as this
is a pretty severe configuration error of the OS in my opinion.
These patches are against version 1.24.
Subject: | 0002-Added-warning-about-faulty-DNS-resolver-setup-to-t-b.patch |
From b34eefa7b074389bf38502432fc7ada63de719a1 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Robin=20Smidsr=C3=B8d?= <robin@smidsrod.no>
Date: Mon, 6 Jul 2009 20:27:39 +0200
Subject: [PATCH 2/2] Added warning about faulty DNS resolver setup to t/back_ok.t
---
t/back_ok.t | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/t/back_ok.t b/t/back_ok.t
index 134fd77..08770ac 100644
--- a/t/back_ok.t
+++ b/t/back_ok.t
@@ -8,6 +8,8 @@ use Test::Builder::Tester;
use constant NONEXISTENT => 'http://wango.nonexistent.xx-only-testing/';
BEGIN {
if ( gethostbyname( 'wango.nonexistent.xx-only-testing' ) ) {
+ diag("A non-existent domain name actually resolved.");
+ diag("Your DNS resolver's search path is probably pointing to a domain with wildcard DNS.");
plan skip_all => 'Found an A record for the non-existent domain';
}
}
--
1.6.3.2
Subject: | 0001-Testing-for-non-existing-hostnames-now-fail-if-wildc.patch |
From d849987e2906291eef7eb70b3284d3781d19aaa3 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Robin=20Smidsr=C3=B8d?= <robin@smidsrod.no>
Date: Mon, 6 Jul 2009 20:17:38 +0200
Subject: [PATCH 1/2] Testing for non-existing hostnames now fail if wildcard DNS is in effect.
The previous one only checked if non-existing root domains resolved.
This patch checks if the resolver actually resolves non-existing domain names
without a dot on the end. If your resolv.conf search domain actually resolves
to a domain with wildcard DNS a lot of strange things can happen.
---
t/back_ok.t | 6 +++---
t/get_ok.t | 6 +++---
t/head_ok.t | 6 +++---
t/put_ok.t | 6 +++---
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/t/back_ok.t b/t/back_ok.t
index 7042c90..134fd77 100644
--- a/t/back_ok.t
+++ b/t/back_ok.t
@@ -5,9 +5,9 @@ use warnings;
use Test::More;
use Test::Builder::Tester;
-use constant NONEXISTENT => 'http://blahblablah.xx-nonexistent.';
+use constant NONEXISTENT => 'http://wango.nonexistent.xx-only-testing/';
BEGIN {
- if ( gethostbyname( 'blahblahblah.xx-nonexistent.' ) ) {
+ if ( gethostbyname( 'wango.nonexistent.xx-only-testing' ) ) {
plan skip_all => 'Found an A record for the non-existent domain';
}
}
@@ -47,7 +47,7 @@ GOOD_GET: {
}
BAD_GET: {
- my $badurl = 'http://wango.nonexistent.xx-only-testing/';
+ my $badurl = NONEXISTENT;
$mech->get($badurl);
ok(!$mech->success, q{sanity check: we can't load NONEXISTENT.html});
diff --git a/t/get_ok.t b/t/get_ok.t
index 4df896f..396921c 100644
--- a/t/get_ok.t
+++ b/t/get_ok.t
@@ -5,10 +5,10 @@ use warnings;
use Test::More;
use Test::Builder::Tester;
-use constant NONEXISTENT => 'http://blahblablah.xx-nonexistent.';
+use constant NONEXISTENT => 'http://wango.nonexistent.xx-only-testing/';
BEGIN {
- if ( gethostbyname( 'blahblahblah.xx-nonexistent.' ) ) {
+ if ( gethostbyname( 'wango.nonexistent.xx-only-testing' ) ) {
plan skip_all => 'Found an A record for the non-existent domain';
}
}
@@ -48,7 +48,7 @@ GOOD_GET: {
}
BAD_GET: {
- my $badurl = 'http://wango.nonexistent.xx-only-testing/';
+ my $badurl = NONEXISTENT;
$mech->get($badurl);
ok(!$mech->success, q{sanity check: we can't load NONEXISTENT.html});
diff --git a/t/head_ok.t b/t/head_ok.t
index c123e70..28ca3f5 100644
--- a/t/head_ok.t
+++ b/t/head_ok.t
@@ -5,9 +5,9 @@ use warnings;
use Test::More;
use Test::Builder::Tester;
-use constant NONEXISTENT => 'http://blahblablah.xx-nonexistent.';
+use constant NONEXISTENT => 'http://wango.nonexistent.xx-only-testing/';
BEGIN {
- if ( gethostbyname( NONEXISTENT ) ) {
+ if ( gethostbyname( 'wango.nonexistent.xx-only-testing' ) ) {
plan skip_all => 'Found an A record for the non-existent domain';
}
}
@@ -47,7 +47,7 @@ GOOD_HEAD: { # Stop giggling, you!
}
BAD_HEAD: {
- my $badurl = 'http://wango.nonexistent.xx-only-testing/';
+ my $badurl = NONEXISTENT;
$mech->head($badurl);
ok(!$mech->success, q{sanity check: we can't load NONEXISTENT.html} );
diff --git a/t/put_ok.t b/t/put_ok.t
index ce174ef..e281287 100644
--- a/t/put_ok.t
+++ b/t/put_ok.t
@@ -5,9 +5,9 @@ use warnings;
use Test::More;
use Test::Builder::Tester;
-use constant NONEXISTENT => 'http://blahblablah.xx-nonexistent.';
+use constant NONEXISTENT => 'http://wango.nonexistent.xx-only-testing/';
BEGIN {
- if ( gethostbyname( 'blahblahblah.xx-nonexistent.' ) ) {
+ if ( gethostbyname( 'wango.nonexistent.xx-only-testing' ) ) {
plan skip_all => 'Found an A record for the non-existent domain';
}
}
@@ -46,7 +46,7 @@ GOOD_PUT: {
}
BAD_PUT: {
- my $badurl = 'http://wango.nonexistent.xx-only-testing/';
+ my $badurl = NONEXISTENT;
$mech->put($badurl);
ok(!$mech->success, q{sanity check: we can't load NONEXISTENT.html});
--
1.6.3.2