X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fpsgi_v2.t;h=7ab60adcc46f00f33cec66b2b64ccbeb4903204a;hb=af0b0fb7a454470a32c452119d0392e0dedb3fe1;hp=4ab9601c0f91985dfcd20f6876dd13ce17910dc1;hpb=9eac193c72e1380972f3589cb6b4f36b79183233;p=public-inbox.git diff --git a/t/psgi_v2.t b/t/psgi_v2.t index 4ab9601c..7ab60adc 100644 --- a/t/psgi_v2.t +++ b/t/psgi_v2.t @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2020 all contributors +# Copyright (C) 2018-2021 all contributors # License: AGPL-3.0+ use strict; use warnings; @@ -40,7 +40,11 @@ my $run_httpd = sub { Plack::Test::ExternalServer::test_psgi(client => $client); $td->join('TERM'); open my $fh, '<', $err or BAIL_OUT $!; - is(do { local $/; <$fh> }, '', 'no errors'); + my $e = do { local $/; <$fh> }; + if ($e =~ s/^Plack::Middleware::ReverseProxy missing,\n//gms) { + $e =~ s/^URL generation for redirects .*\n//gms; + } + is($e, '', 'no errors'); } }; @@ -83,12 +87,11 @@ like($$msg, qr/\AFrom oldbug/s, '"From_" line stored to test old bug workaround'); my $cfgpfx = "publicinbox.v2test"; -my $cfg = <new(\<{-primary_address} $cfgpfx.inboxdir=$inboxdir EOF -my $config = PublicInbox::Config->new(\$cfg); -my $www = PublicInbox::WWW->new($config); +my $www = PublicInbox::WWW->new($cfg); my ($res, $raw, @from_); my $client0 = sub { my ($cb) = @_; @@ -150,7 +153,7 @@ my $client1 = sub { like($raw, qr/^hello ghosts$/m, 'got third message'); @from_ = ($raw =~ m/^From /mg); is(scalar(@from_), 3, 'three From_ lines'); - $config->each_inbox(sub { $_[0]->search->reopen }); + $cfg->each_inbox(sub { $_[0]->search->reopen }); SKIP: { eval { require IO::Uncompress::Gunzip }; @@ -240,7 +243,7 @@ $run_httpd->($client1, 38); $im->done; my @h = $mime->header('Message-ID'); is_deeply($exp, \@h, 'reused existing Message-ID'); - $config->each_inbox(sub { $_[0]->search->reopen }); + $cfg->each_inbox(sub { $_[0]->search->reopen }); } my $client2 = sub { @@ -279,7 +282,7 @@ $run_httpd->($client2, 8); ok($im->add($mime), "added attachment $body"); } $im->done; - $config->each_inbox(sub { $_[0]->search->reopen }); + $cfg->each_inbox(sub { $_[0]->search->reopen }); } my $client3 = sub { @@ -296,6 +299,9 @@ my $client3 = sub { } $res = $cb->(GET('/v2test/?t=1970'.'01'.'01'.'000000')); is($res->code, 404, '404 for out-of-range t= param'); + @warn = (); + $res = $cb->(GET('/v2test/?t=1970'.'01'.'01')); + is_deeply(\@warn, [], 'no warnings on YYYYMMDD only'); }; test_psgi(sub { $www->call(@_) }, $client3); $run_httpd->($client3, 4);