From 31eda8c90633766692156c9c0af061dad6299c84 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 29 Jul 2018 09:34:40 +0000 Subject: t/v2mda: make it easy to test v1 repos here, too It will help track down a bug which only seems to happen in v2 repos. --- t/v2mda.t | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/t/v2mda.t b/t/v2mda.t index f386289a..7df3a43a 100644 --- 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'); -- cgit v1.2.3-24-ge0c7