From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 2/4] tests: add some basic "lei reindex" tests
Date: Fri, 19 Aug 2022 09:07:43 +0000 [thread overview]
Message-ID: <20220819090745.4094018-3-e@80x24.org> (raw)
In-Reply-To: <20220819090745.4094018-1-e@80x24.org>
This is a bit hard-to-test, but at least we must ensure
volatile-metadata is preserved.
---
MANIFEST | 1 +
t/lei-index.t | 12 +++++++++++-
t/lei-reindex.t | 12 ++++++++++++
3 files changed, 24 insertions(+), 1 deletion(-)
create mode 100644 t/lei-reindex.t
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;
next prev parent reply other threads:[~2022-08-19 9:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-19 9:07 [PATCH 0/4] lei reindex-related stuff Eric Wong
2022-08-19 9:07 ` [PATCH 1/4] lei reindex: account for parallel lei/store users Eric Wong
2022-08-19 9:07 ` Eric Wong [this message]
2022-08-19 9:07 ` [PATCH 3/4] smsg: ->populate falls back to old {ds}/{ts} values Eric Wong
2022-08-19 9:07 ` [PATCH 4/4] lei/store: reindex culls over-indexed messages Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220819090745.4094018-3-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).