From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.1 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 7C983208EA for ; Sun, 29 Jul 2018 09:34:41 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/3] t/v2mda: make it easy to test v1 repos here, too Date: Sun, 29 Jul 2018 09:34:40 +0000 Message-Id: <20180729093441.5250-3-e@80x24.org> In-Reply-To: <20180729093441.5250-1-e@80x24.org> References: <20180729093441.5250-1-e@80x24.org> List-Id: 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 f386289..7df3a43 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'); -- EW