about summary refs log tree commit homepage
path: root/t/nntpd.t
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-07-14 02:14:31 +0000
committerEric Wong <e@yhbt.net>2020-07-14 23:22:59 +0000
commit322a79a6421b5993775f63ea25294a97c5203ac0 (patch)
tree32e94eb9dafead35e830fee28cb90d3bc43ec7c4 /t/nntpd.t
parente9fc1290ead44e06d20ff58e0a6acb5306d4fbe2 (diff)
downloadpublic-inbox-322a79a6421b5993775f63ea25294a97c5203ac0.tar.gz
While it's even less common to experience a replaced
msgmap.sqlite3 file, BOFHs may do the darndest things.  This is
another step towards reducing the number of needless wakeups
we need to do in long-lived read-only daemons.
Diffstat (limited to 't/nntpd.t')
-rw-r--r--t/nntpd.t8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/nntpd.t b/t/nntpd.t
index 28008ec1..954e6e75 100644
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -14,6 +14,7 @@ use Net::NNTP;
 use Sys::Hostname;
 use POSIX qw(_exit);
 use Digest::SHA;
+use_ok 'PublicInbox::Msgmap';
 
 # FIXME: make easier to test both versions
 my $version = $ENV{PI_TEST_VERSION} || 1;
@@ -341,6 +342,13 @@ Date: Fri, 02 Oct 1993 00:00:00 +0000
                         'article did not exist');
                 $im->add($ex);
                 $im->done;
+                {
+                        my $f = $ibx->mm->{filename};
+                        my $tmp = "$tmpdir/tmp.sqlite3";
+                        $ibx->mm->{dbh}->sqlite_backup_to_file($tmp);
+                        delete $ibx->{mm};
+                        rename($tmp, $f) or BAIL_OUT "rename($tmp, $f): $!";
+                }
                 ok(run_script([qw(-index --reindex -c), $ibx->{inboxdir}],
                                 undef, $noerr), '-compacted');
                 select(undef, undef, undef, $fast_idle ? 0.1 : 2.1);