diff options
author | Eric Wong <e@80x24.org> | 2019-05-29 20:56:32 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-05-29 20:56:59 +0000 |
commit | 3c9ab47c7d0e26fd22e1f42a198696b093629802 (patch) | |
tree | aa6df6d879d82ced06add1d4869c81336d2664e5 /t | |
parent | 4f814ff418e334a9b7b9bd96cd5450c2823de2f6 (diff) | |
download | public-inbox-3c9ab47c7d0e26fd22e1f42a198696b093629802.tar.gz |
And use it from Admin. It's easy to tell what indexlevel=basic is from unconfigured inboxes, but distinguishing between 'medium' and 'full' would require stat()-ing position.* files which is fragile and Xapian-implementation-dependent. So use the metadata facility of Xapian and store it in the main partition so Admin tools can deal better with unconfigured inboxes copied using generic tools like cp(1) or rsync(1).
Diffstat (limited to 't')
-rw-r--r-- | t/indexlevels-mirror.t | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/t/indexlevels-mirror.t b/t/indexlevels-mirror.t index 12511368..bf0f8018 100644 --- a/t/indexlevels-mirror.t +++ b/t/indexlevels-mirror.t @@ -7,6 +7,7 @@ use PublicInbox::MIME; use PublicInbox::Inbox; use PublicInbox::InboxWritable; use File::Temp qw/tempdir/; +require PublicInbox::Admin; require './t/common.perl'; require_git(2.6); my $this = (split('/', __FILE__))[-1]; @@ -119,6 +120,8 @@ sub import_index_incremental { if ($level ne 'basic') { is(system(@xcpdb, $mirror), 0, "v$v xcpdb OK"); + is(PublicInbox::Admin::detect_indexlevel($ro_mirror), $level, + 'indexlevel detectable by Admin after xcpdb v' .$v.$level); delete $ro_mirror->{$_} for (qw(over search)); ($nr, $msgs) = $ro_mirror->search->query('m:m@2'); is($nr, 1, "v$v found m\@2 via Xapian on $level"); @@ -157,6 +160,9 @@ sub import_index_incremental { @rw_nums = map { $_->{num} } @{$ibx->over->query_ts(0, 0)}; is_deeply(\@rw_nums, \@expect, "v$v master has expected NNTP articles"); is_deeply(\@ro_nums, \@expect, "v$v mirror matches master articles"); + + is(PublicInbox::Admin::detect_indexlevel($ro_mirror), $level, + 'indexlevel detectable by Admin '.$v.$level); } # we can probably cull some other tests and put full/medium tests, here @@ -172,9 +178,11 @@ SKIP: { require PublicInbox::Search; PublicInbox::Search::load_xapian() or skip 'Search::Xapian missing', 2; for my $v (1..2) { - subtest("v$v indexlevel=medium" => sub { - import_index_incremental($v, 'medium'); - }) + foreach my $l (qw(medium full)) { + subtest("v$v indexlevel=$l" => sub { + import_index_incremental($v, $l); + }); + } } } |