From e19515ab18d8e5002b39536d9d27ed7243eb4e64 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Tue, 8 Jun 2010 15:32:33 +0100 Subject: [PATCH] Correct Red Hat connection-failure checks -- addinfo is empty when errcode==TIMEOUT --- t/1-Net-Z3950-ZOOM.t | 4 ++-- t/2-ZOOM.t | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/t/1-Net-Z3950-ZOOM.t b/t/1-Net-Z3950-ZOOM.t index 27c479e..1e85894 100644 --- a/t/1-Net-Z3950-ZOOM.t +++ b/t/1-Net-Z3950-ZOOM.t @@ -20,8 +20,8 @@ my $host = "no.such.host"; my $conn = Net::Z3950::ZOOM::connection_new($host, 0); $errcode = Net::Z3950::ZOOM::connection_error($conn, $errmsg, $addinfo); # For some reason, Red Hat signals this as a TIMEOUT rather than a CONNECT -ok(($errcode == Net::Z3950::ZOOM::ERROR_CONNECT || - $errcode == Net::Z3950::ZOOM::ERROR_TIMEOUT) && $addinfo eq $host, +ok(($errcode == Net::Z3950::ZOOM::ERROR_CONNECT && $addinfo eq $host) || + ($errcode == Net::Z3950::ZOOM::ERROR_TIMEOUT && $addinfo eq ""), "connection to non-existent host '$host' fails: errcode=$errcode, addinfo=$addinfo"); $host = "z3950.indexdata.com/gils"; diff --git a/t/2-ZOOM.t b/t/2-ZOOM.t index aaf867d..ada3ea4 100644 --- a/t/2-ZOOM.t +++ b/t/2-ZOOM.t @@ -19,8 +19,8 @@ my $conn; eval { $conn = new ZOOM::Connection($host, 0) }; # For some reason, Red Hat signals this as a TIMEOUT rather than a CONNECT ok($@ && $@->isa("ZOOM::Exception") && - ($@->code() == ZOOM::Error::CONNECT || - $@->code() == ZOOM::Error::TIMEOUT) && $@->addinfo() eq $host, + (($@->code() == ZOOM::Error::CONNECT && $@->addinfo() eq $host) || + ($@->code() == ZOOM::Error::TIMEOUT && $@->addinfo() eq "")), "connection to non-existent host '$host' fails: \$\@=$@"); $host = "z3950.indexdata.com/gils"; -- 1.7.10.4