Subject: | Some tests fail that shouldn't |
Hi,
A couple of tests in HTTP::Proxy fail that probably shouldn't.
1) When using a firewall proxy such as the one at my company, I get a 503 error instead of
the 500 error expected by the tests when requesting http://www.error.zzz/ . Probably
anything in the 500 series should be okay. This is in t/22http.t.
2) In t/23connect.t, the "check if we can actually connect" seems to hang indefinitely (or at
least really long). I put a Timeout => 5 in the IO::Socket::INET->new() call, and it gets
properly skipped.
I still get a few problems in t/90diveintomark.t, but I'm not sure what's going on there yet.
Patch is below.
-Ken
--- t/22http.t~ 2006-04-28 12:56:43.000000000 -0500
+++ t/22http.t 2006-06-19 11:35:42.000000000 -0500
@@ -7,7 +7,7 @@
[ 'http://www.mongueurs.net/', 200 ],
[ 'http://httpd.apache.org/docs', 301 ],
[ 'http://www.google.com/testing/', 404 ],
- [ 'http://www.error.zzz/', 500 ],
+ [ 'http://www.error.zzz/', qr{^5\d\d$} ],
);
}
@@ -46,7 +46,8 @@
for (@requests) {
my $req = HTTP::Request->new( GET => $_->[0] );
my $rep = $ua->simple_request($req);
- is( $rep->code, $_->[1], "Got an answer (@{[$rep->code]})" );
+ my $subr = ref($_->[1]) ? \&like : \&is;
+ $subr->( $rep->code, $_->[1], "Got an answer (@{[$rep->code]})" );
}
# make sure the kid is dead
--- t/23connect.t~ 2006-04-28 12:56:43.000000000 -0500
+++ t/23connect.t 2006-06-19 09:38:53.000000000 -0500
@@ -16,7 +16,7 @@
SKIP:
{
# check if we can actually connect
- my $sock = IO::Socket::INET->new( PeerAddr => $host )
+ my $sock = IO::Socket::INET->new( PeerAddr => $host, Timeout => 5 )
or skip "Direct connection to $host impossible", 4;
my $banner = <$sock>;
close $sock;