]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/extsearch.t
extindex: implement --dedupe to fix old extindices
[public-inbox.git] / t / extsearch.t
index d199fc7b9804055fec9c79f2a79ed1a4d3f7489c..5f0cd8662bfc0a102bbc32223e4c42a0fa199a30 100644 (file)
@@ -236,6 +236,7 @@ if ('inject w/o indexing') {
 
 if ('reindex catches missed messages') {
        my $v2ibx = $cfg->lookup_name('v2test');
+       $v2ibx->{-no_fsync} = 1;
        my $im = PublicInbox::InboxWritable->new($v2ibx)->importer(0);
        my $cmt_a = $v2ibx->mm->last_commit_xap($schema_version, 0);
        my $eml = eml_load('t/data/0001.patch');
@@ -296,6 +297,7 @@ if ('reindex catches missed messages') {
 if ('reindex catches content bifurcation') {
        use PublicInbox::MID qw(mids);
        my $v2ibx = $cfg->lookup_name('v2test');
+       $v2ibx->{-no_fsync} = 1;
        my $im = PublicInbox::InboxWritable->new($v2ibx)->importer(0);
        my $eml = eml_load('t/data/message_embed.eml');
        my $cmt_a = $v2ibx->mm->last_commit_xap($schema_version, 0);
@@ -366,4 +368,15 @@ if ('remove v1test and test gc') {
        is(scalar(@it), 1, 'only one inbox left');
 }
 
+if ('dedupe + dry-run') {
+       my @cmd = ('-extindex', "$home/extindex");
+       my $opt = { 2 => \(my $err = '') };
+       ok(run_script([@cmd, '--dedupe'], undef, $opt), '--dedupe');
+       ok(run_script([@cmd, qw(--dedupe --dry-run)], undef, $opt),
+               '--dry-run --dedupe');
+       is $err, '', 'no errors';
+       ok(!run_script([@cmd, qw(--dry-run)], undef, $opt),
+               '--dry-run alone fails');
+}
+
 done_testing;