]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/TestCommon.pm
www: fix unindexed v1 inboxes w/ public-inbox-httpd
[public-inbox.git] / lib / PublicInbox / TestCommon.pm
index 943dd2fa9d111c85f1222a9e853264af20bb4205..55d82fc08592d0efa1370e1aeb7f4e2886075d49 100644 (file)
@@ -136,7 +136,7 @@ sub require_mods {
                        push @mods, qw(Parse::RecDescent DBD::SQLite
                                        Email::Address::XS||Mail::Address);
                        next;
-               } elsif ($mod eq '-nntpd') {
+               } elsif ($mod eq '-nntpd' || $mod eq 'v2') {
                        push @mods, qw(DBD::SQLite);
                        next;
                }
@@ -378,7 +378,7 @@ sub wait_for_tail {
                my @ino;
                do {
                        @ino = grep {
-                               readlink($_) =~ /\binotify\b/
+                               (readlink($_) // '') =~ /\binotify\b/
                        } glob("/proc/$tail_pid/fd/*");
                } while (!@ino && time <= $end and tick);
                return if !@ino;
@@ -740,14 +740,18 @@ sub test_httpd ($$;$) {
                $env->{$_} or BAIL_OUT "$_ unset";
        }
        SKIP: {
-               require_mods(qw(Plack::Test::ExternalServer), $skip // 1);
+               require_mods(qw(Plack::Test::ExternalServer LWP::UserAgent),
+                               $skip // 1);
                my $sock = tcp_server() or die;
                my ($out, $err) = map { "$env->{TMPDIR}/std$_.log" } qw(out err);
                my $cmd = [ qw(-httpd -W0), "--stdout=$out", "--stderr=$err" ];
                my $td = start_script($cmd, $env, { 3 => $sock });
                my ($h, $p) = tcp_host_port($sock);
                local $ENV{PLACK_TEST_EXTERNALSERVER_URI} = "http://$h:$p";
-               Plack::Test::ExternalServer::test_psgi(client => $client);
+               my $ua = LWP::UserAgent->new;
+               $ua->max_redirect(0);
+               Plack::Test::ExternalServer::test_psgi(client => $client,
+                                                       ua => $ua);
                $td->join('TERM');
                open my $fh, '<', $err or BAIL_OUT $!;
                my $e = do { local $/; <$fh> };