about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-06-20 00:13:01 +0000
committerEric Wong <e@yhbt.net>2020-06-21 17:31:42 +0000
commit476f054f21ee64a08418cacb23b5a48c68858441 (patch)
treeae297cefefa1a56e7683dadcef27e8f2f7b29551
parent0e6ceff37fc38f28a1520d7475f31d47f74ec7e6 (diff)
downloadpublic-inbox-476f054f21ee64a08418cacb23b5a48c68858441.tar.gz
testcommon: require IO::Socket::SSL >= 2.007
Net::NNTP does not support older IO::Socket::SSL.  1.94 on
CentOS 7.x fails HTTPS and IMAPS tests, too.

cf. https://rt.cpan.org/Ticket/Display.html?id=100529
-rw-r--r--lib/PublicInbox/TestCommon.pm10
-rw-r--r--t/nntpd-tls.t2
-rw-r--r--t/nntpd.t5
3 files changed, 9 insertions, 8 deletions
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index a97125e5..6bf4526a 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -95,7 +95,15 @@ sub require_mods {
                 } else {
                         eval "require $mod";
                 }
-                push @need, $mod if $@;
+                if ($@) {
+                        push @need, $mod;
+                } elsif ($mod eq 'IO::Socket::SSL' &&
+                        # old versions of IO::Socket::SSL aren't supported
+                        # by libnet, at least:
+                        # https://rt.cpan.org/Ticket/Display.html?id=100529
+                                !eval{ IO::Socket::SSL->VERSION(2.007); 1 }) {
+                        push @need, $@;
+                }
         }
         return unless @need;
         my $m = join(', ', @need)." missing for $0";
diff --git a/t/nntpd-tls.t b/t/nntpd-tls.t
index 3de219f1..23baf4e4 100644
--- a/t/nntpd-tls.t
+++ b/t/nntpd-tls.t
@@ -10,8 +10,6 @@ use PublicInbox::TestCommon;
 require_mods(qw(DBD::SQLite IO::Socket::SSL Net::NNTP IO::Poll));
 Net::NNTP->can('starttls') or
         plan skip_all => 'Net::NNTP does not support TLS';
-IO::Socket::SSL->VERSION(2.007) or
-        plan skip_all => 'IO::Socket::SSL <2.007 not supported by Net::NNTP';
 
 my $cert = 'certs/server-cert.pem';
 my $key = 'certs/server-key.pem';
diff --git a/t/nntpd.t b/t/nntpd.t
index c681b01c..9d0ee2ba 100644
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -111,11 +111,6 @@ EOF
                 $n->can('starttls') or
                         skip('Net::NNTP too old to support STARTTLS', 2);
                 require_mods('IO::Socket::SSL', 2);
-                eval {
-                        IO::Socket::SSL->VERSION(2.007);
-                } or skip(<<EOF, 2);
-IO::Socket::SSL <2.007 not supported by Net::NNTP
-EOF
                 ok(!$n->starttls, 'STARTTLS fails when unconfigured');
                 is($n->code, 580, 'got 580 code on server w/o TLS');
         };