about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-19 08:14:39 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-19 08:16:34 +0000
commiteb48e7d6675babdda9a36be1a490c29a2ccddbdc (patch)
treeeaa6056df3a6eabe9952b7265c9770de6b3575f1 /t
parentb20b8747256433b0b7b4d1ed5c415d2101044dda (diff)
downloadpublic-inbox-eb48e7d6675babdda9a36be1a490c29a2ccddbdc.tar.gz
We need to hide removals from anybody hitting the search engine.
Diffstat (limited to 't')
-rw-r--r--t/v2writable.t18
1 files changed, 17 insertions, 1 deletions
diff --git a/t/v2writable.t b/t/v2writable.t
index 7d276da7..6e37b722 100644
--- a/t/v2writable.t
+++ b/t/v2writable.t
@@ -36,12 +36,13 @@ my $im = eval {
 };
 is($im->{partitions}, 1, 'one partition when forced');
 ok($im->add($mime), 'ordinary message added');
+my $git0;
 
 if ('ensure git configs are correct') {
         my @cmd = (qw(git config), "--file=$mainrepo/all.git/config",
                 qw(core.sharedRepository 0644));
         is(system(@cmd), 0, "set sharedRepository in all.git");
-        my $git0 = PublicInbox::Git->new("$mainrepo/git/0.git");
+        $git0 = PublicInbox::Git->new("$mainrepo/git/0.git");
         my $fh = $git0->popen(qw(config core.sharedRepository));
         my $v = eval { local $/; <$fh> };
         chomp $v;
@@ -189,8 +190,23 @@ EOF
 };
 {
         local $ENV{NPROC} = 2;
+        my @before = $git0->qx(qw(log --pretty=oneline));
         $im = PublicInbox::V2Writable->new($ibx, 1);
         is($im->{partitions}, 1, 'detected single partition from previous');
+        my $smsg = $im->remove($mime, 'test removal');
+        my @after = $git0->qx(qw(log --pretty=oneline));
+        $im->done;
+        my $tip = shift @after;
+        like($tip, qr/\A[a-f0-9]+ test removal\n\z/s,
+                'commit message propaged to git');
+        is_deeply(\@after, \@before, 'only one commit written to git');
+        is($ibx->mm->num_for($smsg->mid), undef, 'no longer in Msgmap by mid');
+        like($smsg->num, qr/\A\d+\z/, 'numeric number in return message');
+        is($ibx->mm->mid_for($smsg->num), undef, 'no longer in Msgmap by num');
+        my $srch = $ibx->search->reopen;
+        my @found = ();
+        $srch->each_smsg_by_mid($smsg->mid, sub { push @found, @_; 1 });
+        is(scalar(@found), 0, 'no longer found in Xapian skeleton');
 }
 
 done_testing();