about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-11-22 01:04:18 +0000
committerEric Wong <e@80x24.org>2023-11-22 22:16:34 +0000
commit19655cb200b8d0ecbd217d4c468bbba8d40ce014 (patch)
tree6031e9972be21d3e7ac95583b36994d8d3fb334b /t
parentb64ce2044b0a9413855ad63ded4ddc9433e4ea9b (diff)
downloadpublic-inbox-19655cb200b8d0ecbd217d4c468bbba8d40ce014.tar.gz
For users hosting read-only mirrors (via clone|fetch) and feeding
inboxes via -watch
Diffstat (limited to 't')
-rw-r--r--t/watch_maildir.t12
1 files changed, 11 insertions, 1 deletions
diff --git a/t/watch_maildir.t b/t/watch_maildir.t
index 69a5e1f3..07ebeef6 100644
--- a/t/watch_maildir.t
+++ b/t/watch_maildir.t
@@ -16,7 +16,6 @@ use_ok 'PublicInbox::Emergency';
 my $addr = 'test-public@example.com';
 my $default_branch = PublicInbox::Import::default_branch;
 PublicInbox::Import::init_bare($git_dir);
-
 my $msg = <<EOF;
 From: user\@example.com
 To: $addr
@@ -26,6 +25,9 @@ Date: Sat, 18 Jun 2016 00:00:00 +0000
 
 something
 EOF
+
+my $ibx_ro = create_inbox 'ro', sub { $_[0]->add(PublicInbox::Eml->new($msg)) };
+
 PublicInbox::Emergency->new($maildir)->prepare(\$msg);
 ok(POSIX::mkfifo("$maildir/cur/fifo", 0777),
         'create FIFO to ensure we do not get stuck on it :P');
@@ -56,6 +58,10 @@ my $cfg = cfg_new $tmpdir, <<EOF;
         filter = PublicInbox::Filter::Vger
 [publicinboxlearn]
         watchspam = maildir:$spamdir
+[publicinbox "test-ro"]
+        watch = false
+        inboxdir = $ibx_ro->{inboxdir}
+        address = ro-test\@example.com
 EOF
 my $cfg_path = $cfg->{-f};
 PublicInbox::Watch->new($cfg)->scan('full');
@@ -82,6 +88,10 @@ is(scalar @list, 2, 'two revisions in rev-list');
 is(scalar @list, 0, 'tree is empty');
 is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam');
 
+@list = $ibx_ro->git->qx(qw(ls-tree -r --name-only), $default_branch);
+undef $ibx_ro;
+is scalar(@list), 1, 'read-only inbox is unchanged';
+
 # check with scrubbing
 {
         $msg .= qq(--