about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-08-19 09:07:43 +0000
committerEric Wong <e@80x24.org>2022-08-19 18:46:45 +0000
commit4ac15319847bc91ab2b7e8bb4b9f8955ba9fd55c (patch)
treedb26f73f706862578656926132fa9ceb4c720fab
parentede63a345dfa0254e319650baafc7d341ef7a925 (diff)
downloadpublic-inbox-4ac15319847bc91ab2b7e8bb4b9f8955ba9fd55c.tar.gz
This is a bit hard-to-test, but at least we must ensure
volatile-metadata is preserved.
-rw-r--r--MANIFEST1
-rw-r--r--t/lei-index.t12
-rw-r--r--t/lei-reindex.t12
3 files changed, 24 insertions, 1 deletions
diff --git a/MANIFEST b/MANIFEST
index 27e4c4e0..43128382 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -477,6 +477,7 @@ t/lei-q-remote-import.t
 t/lei-q-save.t
 t/lei-q-thread.t
 t/lei-refresh-mail-sync.t
+t/lei-reindex.t
 t/lei-sigpipe.t
 t/lei-tag.t
 t/lei-up.t
diff --git a/t/lei-index.t b/t/lei-index.t
index aab8f7e6..c31b1c3c 100644
--- a/t/lei-index.t
+++ b/t/lei-index.t
@@ -1,5 +1,5 @@
 #!perl -w
-# Copyright (C) 2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict; use v5.10.1; use PublicInbox::TestCommon;
 use File::Spec;
@@ -85,6 +85,10 @@ test_lei({ tmpdir => $tmpdir }, sub {
         lei_ok qw(q m:multipart-html-sucks@11);
         is_deeply(json_utf8->decode($lei_out)->[0]->{'kw'},
                 ['seen'], 'keyword set');
+        lei_ok 'reindex';
+        lei_ok qw(q m:multipart-html-sucks@11);
+        is_deeply(json_utf8->decode($lei_out)->[0]->{'kw'},
+                ['seen'], 'keyword still set after reindex');
 
         $srv->{nntpd} and
                 lei_ok('index', "nntp://$srv->{nntp_host_port}/t.v2");
@@ -104,6 +108,12 @@ test_lei({ tmpdir => $tmpdir }, sub {
         my $t = xqx(['git', "--git-dir=$store_path/ALL.git",
                         qw(cat-file -t), $res_b->{blob}]);
         is($t, "blob\n", 'got blob');
+
+        lei_ok('reindex');
+        lei_ok qw(q m:multipart-html-sucks@11);
+        $res_a = json_utf8->decode($lei_out)->[0];
+        is_deeply($res_a->{'kw'}, ['seen'],
+                'keywords still set after reindex');
 });
 
 done_testing;
diff --git a/t/lei-reindex.t b/t/lei-reindex.t
new file mode 100644
index 00000000..73346ee8
--- /dev/null
+++ b/t/lei-reindex.t
@@ -0,0 +1,12 @@
+#!perl -w
+# Copyright (C) all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
+use v5.12; use PublicInbox::TestCommon;
+require_mods(qw(lei));
+my ($tmpdir, $for_destroy) = tmpdir;
+test_lei(sub {
+        ok(!lei('reindex'), 'reindex fails w/o store');
+        like $lei_err, qr/nothing indexed/, "`nothing indexed' noted";
+});
+
+done_testing;