]> Sergey Matveev's repositories - public-inbox.git/commitdiff
t/v2mda: make it easy to test v1 repos here, too
authorEric Wong <e@80x24.org>
Sun, 29 Jul 2018 09:34:40 +0000 (09:34 +0000)
committerEric Wong <e@80x24.org>
Sun, 29 Jul 2018 09:43:05 +0000 (09:43 +0000)
It will help track down a bug which only seems to happen in v2 repos.

t/v2mda.t

index f386289ad1664c19401ce4160c5f5b5060a395a4..7df3a43a467910a37063929db827a9f2c7fe0833 100644 (file)
--- a/t/v2mda.t
+++ b/t/v2mda.t
@@ -8,6 +8,7 @@ use File::Temp qw/tempdir/;
 use Fcntl qw(SEEK_SET);
 use Cwd;
 
+my $V = 2;
 foreach my $mod (qw(DBD::SQLite Search::Xapian)) {
        eval "require $mod";
        plan skip_all => "$mod missing for v2mda.t" if $@;
@@ -38,7 +39,8 @@ local $ENV{PI_DIR} = "$tmpdir/foo";
 local $ENV{PATH} = "$main_bin:blib/script:$ENV{PATH}";
 local $ENV{PI_EMERGENCY} = "$tmpdir/fail";
 ok(mkdir "$tmpdir/fail");
-my @cmd = (qw(public-inbox-init -V2), $ibx->{name},
+
+my @cmd = (qw(public-inbox-init), "-V$V", $ibx->{name},
                $ibx->{mainrepo}, 'http://localhost/test',
                $ibx->{address}->[0]);
 ok(PublicInbox::Import::run_die(\@cmd), 'initialized v2 inbox');
@@ -54,6 +56,11 @@ ok(PublicInbox::Import::run_die(['public-inbox-mda'], undef, $rdr),
        'mda delivered a message');
 
 $ibx = PublicInbox::Inbox->new($ibx);
+
+if ($V == 1) {
+       my $cmd = [ 'public-inbox-index', "$tmpdir/inbox" ];
+       ok(PublicInbox::Import::run_die($cmd, undef, $rdr), 'v1 indexed');
+}
 my $msgs = $ibx->search->query('');
 my $saved = $ibx->smsg_mime($msgs->[0]);
 is($saved->{mime}->as_string, $mime->as_string, 'injected message');