X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Findexlevels-mirror.t;h=ac85643d0423e82bcd7488fc1989f5f312960bc5;hb=refs%2Fheads%2Fmaster;hp=bd140cc427ba7c1a980c728bc89189344067547b;hpb=4ec05db787bfa6ec2a658d0f9ba3105b3acdca09;p=public-inbox.git diff --git a/t/indexlevels-mirror.t b/t/indexlevels-mirror.t index bd140cc4..463b35be 100644 --- a/t/indexlevels-mirror.t +++ b/t/indexlevels-mirror.t @@ -1,5 +1,5 @@ #!perl -w -# Copyright (C) 2019-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ use strict; use v5.10.1; @@ -34,14 +34,14 @@ my $import_index_incremental = sub { local $ENV{PI_CONFIG} = "$tmpdir/config"; # index master (required for v1) - my @cmd = (qw(-index -j0), $ibx->{inboxdir}, "-L$level"); + my @cmd = (qw(-index -j0 --dangerous), $ibx->{inboxdir}, "-L$level"); push @cmd, '-c' if have_xapian_compact; ok(run_script(\@cmd, undef, { 2 => \$err }), 'index master'); my $ro_master = PublicInbox::Inbox->new({ inboxdir => $ibx->{inboxdir}, indexlevel => $level }); - my $msgs = $ro_master->recent; + my $msgs = $ro_master->over->recent; is(scalar(@$msgs), 1, 'only one message in master, so far'); is($msgs->[0]->{mid}, 'm@1', 'first message in master indexed'); @@ -71,7 +71,7 @@ my $import_index_incremental = sub { inboxdir => $mirror, indexlevel => $level, }); - $msgs = $ro_mirror->recent; + $msgs = $ro_mirror->over->recent; is(scalar(@$msgs), 1, 'only one message, so far'); is($msgs->[0]->{mid}, 'm@1', 'read first message'); @@ -83,7 +83,7 @@ my $import_index_incremental = sub { # mirror updates is(xsys('git', "--git-dir=$fetch_dir", qw(fetch -q)), 0, 'fetch OK'); ok(run_script([qw(-index -j0), $mirror]), "v$v index mirror again OK"); - $msgs = $ro_mirror->recent; + $msgs = $ro_mirror->over->recent; is(scalar(@$msgs), 2, '2nd message seen in mirror'); is_deeply([sort { $a cmp $b } map { $_->{mid} } @$msgs], ['m@1','m@2'], 'got both messages in mirror'); @@ -91,7 +91,7 @@ my $import_index_incremental = sub { # incremental index master (required for v1) ok(run_script([qw(-index -j0), $ibx->{inboxdir}, "-L$level"]), 'index master OK'); - $msgs = $ro_master->recent; + $msgs = $ro_master->over->recent; is(scalar(@$msgs), 2, '2nd message seen in master'); is_deeply([sort { $a cmp $b } map { $_->{mid} } @$msgs], ['m@1','m@2'], 'got both messages in master'); @@ -120,7 +120,7 @@ my $import_index_incremental = sub { # sync the mirror is(xsys('git', "--git-dir=$fetch_dir", qw(fetch -q)), 0, 'fetch OK'); ok(run_script([qw(-index -j0), $mirror]), "v$v index mirror again OK"); - $msgs = $ro_mirror->recent; + $msgs = $ro_mirror->over->recent; is(scalar(@$msgs), 1, '2nd message gone from mirror'); is_deeply([map { $_->{mid} } @$msgs], ['m@1'], 'message unavailable in mirror'); @@ -158,7 +158,8 @@ my $import_index_incremental = sub { SKIP: { skip 'xapian-compact missing', 1 if !have_xapian_compact; my $cmd = [ qw(-compact), $mirror ]; - ok(run_script($cmd, undef, { 2 => \$err}), "compact $level"); + ok(run_script($cmd, undef, { 2 => \$err}), "compact $level") + or diag $err; } };