about summary refs log tree commit homepage
path: root/t/extsearch.t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-07-30 12:18:55 +0000
committerEric Wong <e@80x24.org>2021-07-31 00:14:20 +0000
commitdd80dcaa1e46543893de533938a1651639f91f10 (patch)
tree5adc2105b766957782d9d876f4c7914e9bf89c38 /t/extsearch.t
parentb38ffe92ee5ccb5eb4e5892e8cafba85303cadfc (diff)
downloadpublic-inbox-dd80dcaa1e46543893de533938a1651639f91f10.tar.gz
Since extindex uses Xapian shards in a similar way to
v2 inboxes, we'll support -xcpdb (reshard+upgrade) and
-compact all the same to give admins tuning+upgrade
options.
Diffstat (limited to 't/extsearch.t')
-rw-r--r--t/extsearch.t32
1 files changed, 32 insertions, 0 deletions
diff --git a/t/extsearch.t b/t/extsearch.t
index 1f62e80c..d933b948 100644
--- a/t/extsearch.t
+++ b/t/extsearch.t
@@ -422,4 +422,36 @@ for my $j (1, 3, 6) {
         like($dirs[-1], qr!/ei[0-9]+/$max\z!, '-j works');
 }
 
+SKIP: {
+        my $d = "$home/extindex-j1";
+        my $o = { 2 => \(my $err = '') };
+        ok(run_script([qw(-xcpdb -R4), $d]), 'xcpdb R4');
+        my @dirs = glob("$d/ei*/?");
+        for my $i (0..3) {
+                is(grep(m!/ei[0-9]+/$i\z!, @dirs), 1, "shard [$i] created");
+        }
+        for my $i (4..5) {
+                is(grep(m!/ei[0-9]+/$i\z!, @dirs), 0, "no shard [$i]");
+        }
+
+        ok(run_script([qw(-xcpdb -R2), $d]), 'xcpdb -R2');
+        @dirs = glob("$d/ei*/?");
+        for my $i (0..1) {
+                is(grep(m!/ei[0-9]+/$i\z!, @dirs), 1, "shard [$i] kept");
+        }
+        for my $i (2..3) {
+                is(grep(m!/ei[0-9]+/$i\z!, @dirs), 0, "no shard [$i]");
+        }
+        skip 'xapian-compact missing', 4 unless have_xapian_compact;
+        ok(run_script([qw(-compact), $d], undef, $o), 'compact');
+        # n.b. stderr contains xapian-compact output
+
+        my @d2 = glob("$d/ei*/?");
+        is_deeply(\@d2, \@dirs, 'dirs consistent after compact');
+        ok(run_script([qw(-extindex --dedupe --all), $d]),
+                '--dedupe works after compact');
+        ok(run_script([qw(-extindex --gc), $d], undef, $o),
+                '--gc works after compact');
+}
+
 done_testing;