-# Copyright (C) 2018 all contributors <meta@public-inbox.org>
+# Copyright (C) 2018-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
use warnings;
use Test::More;
+require './t/common.perl';
+require_git(2.6);
use File::Temp qw/tempdir/;
use PublicInbox::MIME;
use PublicInbox::Config;
$im->done;
my $cfgpfx = "publicinbox.v2test";
-my $cfg = {
- "$cfgpfx.address" => $ibx->{-primary_address},
- "$cfgpfx.mainrepo" => $mainrepo,
-};
-my $config = PublicInbox::Config->new($cfg);
+my $cfg = <<EOF;
+$cfgpfx.address=$ibx->{-primary_address}
+$cfgpfx.mainrepo=$mainrepo
+EOF
+my $config = PublicInbox::Config->new(\$cfg);
my $www = PublicInbox::WWW->new($config);
my ($res, $raw, @from_);
test_psgi(sub { $www->call(@_) }, 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 });
SKIP: {
eval { require IO::Uncompress::Gunzip };
is(scalar(@from_), 3, 'three From_ lines in t.mbox.gz');
# search interface
- $config->each_inbox(sub { $_[0]->search->reopen });
$res = $cb->(POST('/v2test/?q=m:a-mid@b&x=m'));
$in = $res->content;
$status = IO::Uncompress::Gunzip::gunzip(\$in => \$out);
is(scalar(@from_), 3, 'three From_ lines in all.mbox');
};
+ $res = $cb->(GET('/v2test/?q=m:a-mid@b&x=t'));
+ is($res->code, 200, 'success with threaded search');
+ my $raw = $res->content;
+ ok($raw =~ s/\A.*>Results 1-3 of 3\b//s, 'got all results');
+ my @over = ($raw =~ m/\d{4}-\d+-\d+\s+\d+:\d+ (.+)$/gm);
+ is_deeply(\@over, [ '<a', '` <a', '` <a' ], 'threaded messages show up');
+
local $SIG{__WARN__} = 'DEFAULT';
$res = $cb->(GET('/v2test/a-mid@b/'));
$raw = $res->content;
$res = $cb->(GET('/v2test/reuse@mid/T/'));
$raw = $res->content;
like($raw, qr/\b4\+ messages\b/, 'thread overview shown with /T/');
- my @over = ($raw =~ m/^\d{4}-\d+-\d+\s+\d+:\d+ (.+)$/gm);
+ @over = ($raw =~ m/^\d{4}-\d+-\d+\s+\d+:\d+ (.+)$/gm);
is_deeply(\@over, [ '<a', '` <a', '` <a', '` <a' ],
'duplicate messages share the same root');
$res = $cb->(GET('/v2test/0/info/refs'));
is($res->code, 200, 'got info refs for dumb clones');
+ $res = $cb->(GET('/v2test/0.git/info/refs'));
+ is($res->code, 200, 'got info refs for dumb clones w/ .git suffix');
$res = $cb->(GET('/v2test/info/refs'));
- is($res->code, 404, 'unpartitioned git URL fails');
+ is($res->code, 404, 'v2 git URL w/o shard fails');
# ensure conflicted attachments can be resolved
foreach my $body (qw(old new)) {