X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fv2writable.t;h=6e37b722aa19496ce4b90ed22f804696618c8cf5;hb=eb48e7d6675babdda9a36be1a490c29a2ccddbdc;hp=7d276da7091fb18f9db73930e4e36a3e89634960;hpb=b20b8747256433b0b7b4d1ed5c415d2101044dda;p=public-inbox.git 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();