unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Subject: [PATCH 4/4] tests: no IPv6 on old Net::NNTP, Mail::IMAPClient, HTTP::Tiny
Date: Thu, 29 Sep 2022 17:48:31 +0000	[thread overview]
Message-ID: <20220929174831.2919939-5-e@80x24.org> (raw)
In-Reply-To: <20220929174831.2919939-1-e@80x24.org>

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';

  parent reply	other threads:[~2022-09-29 17:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 18:46 "make test" for 1.9.0 on centos-7 Konstantin Ryabitsev
2022-09-28 19:59 ` Eric Wong
2022-09-28 20:51   ` Konstantin Ryabitsev
2022-09-29 17:48     ` [PATCH 0/4] CentOS 7 fixes + fix Gcf2 everywhere Eric Wong
2022-09-29 17:48       ` [PATCH 1/4] syscall: initialize buffer for vec() Eric Wong
2022-09-29 17:48       ` [PATCH 2/4] treewide: use --globoff with curl(1) Eric Wong
2022-09-29 17:48       ` [PATCH 3/4] gcf2: fix syntax error and require PublicInbox::Git Eric Wong
2022-09-29 17:48       ` Eric Wong [this message]
2022-09-29 19:10       ` [PATCH 0/4] CentOS 7 fixes + fix Gcf2 everywhere Konstantin Ryabitsev
2022-09-29 19:40         ` Eric Wong
2022-09-29 17:54 ` "make test" for 1.9.0 on centos-7 Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220929174831.2919939-5-e@80x24.org \
    --to=e@80x24.org \
    --cc=konstantin@linuxfoundation.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).