The versions of these modules which ship with CentOS 7.x did not support IPv6 properly. --- lib/PublicInbox/TestCommon.pm | 9 +++++++++ t/extsearch.t | 4 ++-- t/nntpd.t | 3 +-- t/v2writable.t | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index 55d82fc0..333791b4 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -117,6 +117,12 @@ sub require_git ($;$) { 1; } +my %IPv6_VERSION = ( + 'Net::NNTP' => 3.00, + 'Mail::IMAPClient' => 3.40, + 'HTTP::Tiny' => 0.042, +); + sub require_mods { my @mods = @_; my $maybe = pop @mods if $mods[-1] =~ /\A[0-9]+\z/; @@ -167,6 +173,9 @@ sub require_mods { !eval{ IO::Socket::SSL->VERSION(2.007); 1 }) { push @need, $@; } + if (defined(my $v = $IPv6_VERSION{$mod})) { + $ENV{TEST_IPV4_ONLY} = 1 if !eval { $mod->VERSION($v) }; + } } return unless @need; my $m = join(', ', @need)." missing for $0"; diff --git a/t/extsearch.t b/t/extsearch.t index 2d7375d6..6cbe5262 100644 --- a/t/extsearch.t +++ b/t/extsearch.t @@ -13,8 +13,6 @@ require PublicInbox::Search; use_ok 'PublicInbox::ExtSearch'; use_ok 'PublicInbox::ExtSearchIdx'; use_ok 'PublicInbox::OverIdx'; -my $sock = tcp_server(); -my $host_port = tcp_host_port($sock); my ($home, $for_destroy) = tmpdir(); local $ENV{HOME} = $home; mkdir "$home/.public-inbox" or BAIL_OUT $!; @@ -125,6 +123,8 @@ EOF SKIP: { require_mods(qw(Net::NNTP), 1); + my $sock = tcp_server(); + my $host_port = tcp_host_port($sock); my ($out, $err) = ("$home/nntpd.out.log", "$home/nntpd.err.log"); my $cmd = [ '-nntpd', '-W0', "--stdout=$out", "--stderr=$err" ]; my $td = start_script($cmd, undef, { 3 => $sock }); diff --git a/t/nntpd.t b/t/nntpd.t index 34e9e1b4..d352c3c1 100644 --- a/t/nntpd.t +++ b/t/nntpd.t @@ -2,10 +2,9 @@ # Copyright (C) all contributors <meta@public-inbox.org> # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt> use strict; use v5.10.1; use PublicInbox::TestCommon; -require_mods(qw(DBD::SQLite)); +require_mods(qw(DBD::SQLite Net::NNTP)); use PublicInbox::Eml; use Socket qw(IPPROTO_TCP TCP_NODELAY); -use Net::NNTP; use Sys::Hostname; use POSIX qw(_exit); use Digest::SHA; diff --git a/t/v2writable.t b/t/v2writable.t index 477621e2..ad946338 100644 --- a/t/v2writable.t +++ b/t/v2writable.t @@ -149,7 +149,7 @@ SELECT COUNT(*) FROM over WHERE num > 0 } { - use Net::NNTP; + require_mods('Net::NNTP', 1); my $err = "$inboxdir/stderr.log"; my $out = "$inboxdir/stdout.log"; my $group = 'inbox.comp.test.v2writable';