about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-12-31 13:51:38 +0000
committerEric Wong <e@80x24.org>2021-01-01 05:00:39 +0000
commitcb2b5984109b2caad941e3a2c952219890079acc (patch)
tree30b6f39a13e62bb06320dd39f5a9780a7d6924a8 /t
parent657695bf0b30ae8ddaef57739c4d24e5e38afdbf (diff)
downloadpublic-inbox-cb2b5984109b2caad941e3a2c952219890079acc.tar.gz
For personal mail, unsent drafts messages are a common source of
messages without Message-IDs.
Diffstat (limited to 't')
-rw-r--r--t/lei_store.t24
1 files changed, 24 insertions, 0 deletions
diff --git a/t/lei_store.t b/t/lei_store.t
index bc0d66c2..beb5a8c4 100644
--- a/t/lei_store.t
+++ b/t/lei_store.t
@@ -100,6 +100,30 @@ for my $parallel (0, 1) {
 SKIP: {
         require_mods(qw(Storable), 1);
         ok($lst->can('ipc_do'), 'ipc_do works if we have Storable');
+        $eml->header_set('Message-ID', '<ipc-test@example>');
+        my $pid = $lst->ipc_worker_spawn('lei-store');
+        ok($pid > 0, 'got a worker');
+        my $smsg = $lst->ipc_do('set_eml', $eml, qw(seen));
+        is(ref($smsg), 'PublicInbox::Smsg', 'set_eml works over ipc');
+        my $ids = $lst->ipc_do('set_eml', $eml, qw(seen));
+        is_deeply($ids, [ $smsg->{num} ], 'docid returned');
+
+        $eml->header_set('Message-ID');
+        my $no_mid = $lst->ipc_do('set_eml', $eml, qw(seen));
+        my $wait = $lst->ipc_do('done');
+        my @kw = $lst->search->msg_keywords($no_mid->{num});
+        is_deeply(\@kw, [qw(seen)], 'ipc set changed kw');
+
+        is(ref($smsg), 'PublicInbox::Smsg', 'no mid works ipc');
+        $ids = $lst->ipc_do('set_eml', $eml, qw(seen));
+        is_deeply($ids, [ $no_mid->{num} ], 'docid returned w/o mid w/ ipc');
+        $lst->ipc_do('done');
+        $lst->ipc_worker_stop;
+        $ids = $lst->ipc_do('set_eml', $eml, qw(seen answered));
+        is_deeply($ids, [ $no_mid->{num} ], 'docid returned w/o mid w/o ipc');
+        $wait = $lst->ipc_do('done');
+        @kw = $lst->search->msg_keywords($no_mid->{num});
+        is_deeply(\@kw, [qw(answered seen)], 'set changed kw w/o ipc');
 }
 
 done_testing;