]> Sergey Matveev's repositories - public-inbox.git/commitdiff
testcommon: require IO::Socket::SSL >= 2.007
authorEric Wong <e@yhbt.net>
Sat, 20 Jun 2020 00:13:01 +0000 (00:13 +0000)
committerEric Wong <e@yhbt.net>
Sun, 21 Jun 2020 17:31:42 +0000 (17:31 +0000)
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

lib/PublicInbox/TestCommon.pm
t/nntpd-tls.t
t/nntpd.t

index a97125e59850a391bcef929bf63b5b8acdc6395e..6bf4526a9f707d44d36ed0fcb8cb169c4e8aac89 100644 (file)
@@ -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";
index 3de219f157330eddd2775a78416c7e4121133035..23baf4e443bbfbad297b1675e41d140216a3028a 100644 (file)
@@ -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';
index c681b01c3d9d4eb40036ae9f8e98543c2f1bd07b..9d0ee2baa6d7eb22e47d37b509f52b3f66b22635 100644 (file)
--- 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');
        };