about summary refs log tree commit homepage
path: root/t
diff options
authorEric Wong <e@yhbt.net>2020-03-28 00:56:04 +0000
committerEric Wong <e@yhbt.net>2020-03-29 23:28:30 +0000
commitb5ddcb3352ef31aeb03b4c4cbb04af3de34a4c4f (patch)
tree6e1a63adf6d5a28add5edf0bd74ca8bcaff2c00f /t
parent8e1ec8836dabc58dfc0115b36ed440b4371b70d7 (diff)
It's more convenient to specify `-c' / `--compact' on the
command-line when reindexing than it is to invoke
public-inbox-compact(1) separately.

This is especially convenient in low-space situations when
public-inbox-index is operating on multiple inboxes
sequentially, as compaction can happen immediately after
indexing each inbox, instead of waiting until all inboxes are
Diffstat (limited to 't')
1 files changed, 13 insertions, 0 deletions
diff --git a/t/convert-compact.t b/t/convert-compact.t
index 1671caad..70609c7d 100644
--- a/t/convert-compact.t
+++ b/t/convert-compact.t
@@ -115,4 +115,17 @@ my $msgs = $ibx->recent({limit => 1000});
 is($msgs->[0]->{mid}, 'a-mid@b', 'message exists in history');
 is(scalar @$msgs, 1, 'only one message in history');
+$ibx = undef;
+$err = '';
+$cmd = [ qw(-index --reindex -c), "$tmpdir/v2" ];
+ok(run_script($cmd, undef, $rdr), '--reindex -c');
+like($err, qr/xapian-compact/, 'xapian-compact ran (-c)');
+$rdr->{2} = \(my $err2 = '');
+$cmd = [ qw(-index --reindex -cc), "$tmpdir/v2" ];
+ok(run_script($cmd, undef, $rdr), '--reindex -c -c');
+like($err2, qr/xapian-compact/, 'xapian-compact ran (-c -c)');
+ok(scalar(split(/\n/, $err2)) > scalar(split(/\n/, $err)),
+        '-compacted twice');