diff options
author | Eric Wong <e@yhbt.net> | 2020-06-21 00:21:33 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-06-23 00:22:18 +0000 |
commit | 5759c29ba5e0c8b2b1135e528e133dc7dde219f8 (patch) | |
tree | 841e315a7c4c54910bcc72868f4eb92a51fcc092 /t | |
parent | 3ba0028804c50b75b1854d0c2bf637ebce0aa8b1 (diff) | |
download | public-inbox-5759c29ba5e0c8b2b1135e528e133dc7dde219f8.tar.gz |
For archivists with only newer mail archives, this option allows reserving reserve NNTP article numbers for yet-to-be-archived old messages. Indexers will need to be updated to support this feature in future commits. -V1 inboxes will now be initialized with SQLite and Xapian support if this option is used, or if --indexlevel= is specified.
Diffstat (limited to 't')
-rw-r--r-- | t/init.t | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -93,12 +93,38 @@ SKIP: { is_deeply($gits, ["$tmpdir/skip1/git/1.git"], 'skip OK'); } - $cmd = [ '-init', '-V2', '--skip-epoch=2', 'skip2', "$tmpdir/skip2", qw(http://example.com/skip2 skip2@example.com) ]; ok(run_script($cmd), "--skip-epoch 2"); my $gits = [ glob("$tmpdir/skip2/git/*.git") ]; is_deeply($gits, ["$tmpdir/skip2/git/2.git"], 'skipping 2 works, too'); + + xsys(qw(git config), "--file=$ENV{PI_DIR}/config", + 'publicinboxmda.spamcheck', 'none') == 0 or + BAIL_OUT "git config $?"; + my $addr = 'skip3@example.com'; + $cmd = [ qw(-init -V2 -Lbasic -N12 skip3), "$tmpdir/skip3", + qw(http://example.com/skip3), $addr ]; + ok(run_script($cmd), '--skip-artnum -V2'); + my $env = { ORIGINAL_RECIPIENT => $addr }; + my $mid = 'skip-artnum@example.com'; + my $msg = "Message-ID: <$mid>\n\n"; + my $rdr = { 0 => \$msg, 2 => \(my $err = '') }; + ok(run_script([qw(-mda --no-precheck)], $env, $rdr), 'deliver V1'); + my $mm = PublicInbox::Msgmap->new_file("$tmpdir/skip3/msgmap.sqlite3"); + my $n = $mm->num_for($mid); + is($n, 13, 'V2 NNTP article numbers skipped via --skip-artnum'); + + $addr = 'skip4@example.com'; + $env = { ORIGINAL_RECIPIENT => $addr }; + $cmd = [ qw(-init -V1 -N12 -Lmedium skip4), "$tmpdir/skip4", + qw(http://example.com/skip4), $addr ]; + ok(run_script($cmd), '--skip-artnum -V1'); + ok(run_script([qw(-mda --no-precheck)], $env, $rdr), 'deliver V1'); + $mm = PublicInbox::Msgmap->new("$tmpdir/skip4"); + system "find $tmpdir/skip4 >&2"; + $n = $mm->num_for($mid); + is($n, 13, 'V1 NNTP article numbers skipped via --skip-artnum'); } done_testing(); |