X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fwww_listing.t;fp=t%2Fwww_listing.t;h=e88bfbc5b003690f23e31d3888b02ec3787dcd39;hb=d922fc44d1afb5e4400f2606c475e42aee087c24;hp=c556a2d72aeb1c8d887c93103e2828141949e872;hpb=d9b0f6432682e4ad0a49f7befccde208e4565f1d;p=public-inbox.git diff --git a/t/www_listing.t b/t/www_listing.t index c556a2d7..e88bfbc5 100644 --- a/t/www_listing.t +++ b/t/www_listing.t @@ -1,5 +1,5 @@ #!perl -w -# Copyright (C) 2019-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ # manifest.js.gz generation and grok-pull integration test use strict; use v5.10.1; use PublicInbox::TestCommon; @@ -115,10 +115,38 @@ SKIP: { my $env = { PI_CONFIG => $cfgfile }; my $cmd = [ '-httpd', '-W0', "--stdout=$out", "--stderr=$err" ]; + my $psgi = "$tmpdir/pfx.psgi"; + { + open my $psgi_fh, '>', $psgi or xbail "open: $!"; + print $psgi_fh <<'EOM' or xbail "print $!"; +use PublicInbox::WWW; +use Plack::Builder; +my $www = PublicInbox::WWW->new; +builder { + enable 'Head'; + mount '/pfx/' => sub { $www->call(@_) } +} +EOM + close $psgi_fh or xbail "close: $!"; + } + + # ensure prefixed mount full clones work: + $td = start_script([@$cmd, $psgi], $env, { 3 => $sock }); + my $opt = { 2 => \(my $clone_err = '') }; + ok(run_script(['-clone', "http://$host:$port/pfx", "$tmpdir/pfx" ], + undef, $opt), 'pfx clone w/pfx') or diag "clone_err=$clone_err"; + undef $td; + $td = start_script($cmd, $env, { 3 => $sock }); # default publicinboxGrokManifest match=domain default tiny_test($json, $host, $port); + + # normal full clone on / + $clone_err = ''; + ok(run_script(['-clone', "http://$host:$port/", "$tmpdir/full" ], + undef, $opt), 'full clone') or diag "clone_err=$clone_err"; + undef $td; print $fh <<"" or xbail "print $!"; @@ -127,9 +155,11 @@ SKIP: { close $fh or xbail "close $!"; $td = start_script($cmd, $env, { 3 => $sock }); - tiny_test($json, $host, $port, 1); undef $sock; + tiny_test($json, $host, $port, 1); + # grok-pull sleeps a long while some places: + # https://lore.kernel.org/tools/20211013110344.GA10632@dcvr/ skip 'TEST_GROK unset', 12 unless $ENV{TEST_GROK}; my $grok_pull = require_cmd('grok-pull', 1) or skip('grok-pull not available', 12);