about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2018-07-14 00:46:01 +0000
committerEric Wong <e@80x24.org>2018-07-15 20:55:14 +0000
commit9ec600316145da85d1ae5644ffaa1acd72b6b177 (patch)
treee6cc24d7a9f3ff3f17b55b7f1c48b4076ee64fe8 /t
parentaca47e05a6026c12c768753c87e6ff769ef6bee4 (diff)
downloadpublic-inbox-9ec600316145da85d1ae5644ffaa1acd72b6b177.tar.gz
The normal behavior is to prevent the deleted messages from
being indexed in the first place.  However, when fetching
incrementally via git; public-inbox-index needs to account for
deleted files which were created outside of the most recent
fetch/reindexing window.

Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 't')
-rw-r--r--t/v2mirror.t28
1 files changed, 27 insertions, 1 deletions
diff --git a/t/v2mirror.t b/t/v2mirror.t
index c0c329ca..f95ad0f5 100644
--- a/t/v2mirror.t
+++ b/t/v2mirror.t
@@ -182,7 +182,33 @@ is($mibx->git->check($to_purge), undef, 'unindex+prune successful in mirror');
         is_deeply(\@warn, [], 'no warnings from index_sync after purge');
 }
 
-$v2w->done;
+# deletes happen in a different fetch window
+{
+        $mset = $mibx->search->reopen->query('m:1@example.com', {mset => 1});
+        is(scalar($mset->items), 1, '1@example.com visible in mirror');
+        $mime->header_set('Message-ID', '<1@example.com>');
+        $mime->header_set('Subject', 'subject = 1');
+        ok($v2w->remove($mime), 'removed <1@example.com> from source');
+        $v2w->done;
+        fetch_each_epoch();
+
+        open my $err, '+>', "$tmpdir/index-err" or die "open: $!";
+        my $ipid = fork;
+        if ($ipid == 0) {
+                dup2(fileno($err), 2) or die "dup2 failed: $!";
+                exec("$script-index", "$tmpdir/m");
+                die "exec fail: $!";
+        }
+        ok($ipid, 'running index');
+        is(waitpid($ipid, 0), $ipid, 'index done');
+        is($?, 0, 'no error from index');
+        ok(seek($err, 0, 0), 'rewound stderr');
+        $err = eval { local $/; <$err> };
+        is($err, '', 'no errors reported by index');
+        $mset = $mibx->search->reopen->query('m:1@example.com', {mset => 1});
+        is(scalar($mset->items), 0, '1@example.com no longer visible in mirror');
+}
+
 ok(kill('TERM', $pid), 'killed httpd');
 $pid = undef;
 waitpid(-1, 0);