From 0b1de991a099b5e8b9a9e3e85b5eaaacc9362dbb Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 15 May 2019 01:18:08 +0000 Subject: lazy load Xapian and make it optional for v2 More tests work without Search::Xapian, now. Usability issues still need to be fixed --- t/indexlevels-mirror.t | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 't/indexlevels-mirror.t') diff --git a/t/indexlevels-mirror.t b/t/indexlevels-mirror.t index e25b827f..cac7050b 100644 --- a/t/indexlevels-mirror.t +++ b/t/indexlevels-mirror.t @@ -10,8 +10,7 @@ require './t/common.perl'; require_git(2.6); my $this = (split('/', __FILE__))[-1]; -# TODO: remove Search::Xapian as a requirement for basic -foreach my $mod (qw(DBD::SQLite Search::Xapian)) { +foreach my $mod (qw(DBD::SQLite)) { eval "require $mod"; plan skip_all => "$mod missing for $this" if $@; } @@ -47,8 +46,11 @@ sub import_index_incremental { $im->done; # index master (required for v1) - is(system($index, $ibx->{mainrepo}), 0, 'index master OK'); - my $ro_master = PublicInbox::Inbox->new({mainrepo => $ibx->{mainrepo}}); + is(system($index, $ibx->{mainrepo}, "-L$level"), 0, 'index master OK'); + my $ro_master = PublicInbox::Inbox->new({ + mainrepo => $ibx->{mainrepo}, + indexlevel => $level + }); my ($nr, $msgs) = $ro_master->recent; is($nr, 1, 'only one message in master, so far'); is($msgs->[0]->{mid}, 'm@1', 'first message in master indexed'); @@ -75,7 +77,10 @@ sub import_index_incremental { is(system($index, $mirror), 0, "v$v index mirror OK"); # read-only access - my $ro_mirror = PublicInbox::Inbox->new({mainrepo => $mirror}); + my $ro_mirror = PublicInbox::Inbox->new({ + mainrepo => $mirror, + indexlevel => 'basic' + }); ($nr, $msgs) = $ro_mirror->recent; is($nr, 1, 'only one message, so far'); is($msgs->[0]->{mid}, 'm@1', 'read first message'); @@ -94,7 +99,7 @@ sub import_index_incremental { ['m@1','m@2'], 'got both messages in mirror'); # incremental index master (required for v1) - is(system($index, $ibx->{mainrepo}), 0, 'index master OK'); + is(system($index, $ibx->{mainrepo}, "-L$level"), 0, 'index master OK'); ($nr, $msgs) = $ro_master->recent; is($nr, 2, '2nd message seen in master'); is_deeply([sort { $a cmp $b } map { $_->{mid} } @$msgs], -- cgit v1.2.3-24-ge0c7