From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id EDF481F487 for ; Wed, 1 Apr 2020 05:59:15 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] t/xcpdb-reshard: skip --compact if xapian-compact(1) is missing Date: Wed, 1 Apr 2020 00:59:15 -0500 Message-Id: <20200401055915.29866-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Skip a small part of a test than fail entirely because xapian-compact is not installed. --- t/xcpdb-reshard.t | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/t/xcpdb-reshard.t b/t/xcpdb-reshard.t index 58932fc2..d3cb36c5 100644 --- a/t/xcpdb-reshard.t +++ b/t/xcpdb-reshard.t @@ -8,6 +8,7 @@ require_mods(qw(DBD::SQLite Search::Xapian)); require_git('2.6'); use PublicInbox::MIME; use PublicInbox::InboxWritable; +use PublicInbox::Spawn qw(which); require PublicInbox::Search; my $mime = PublicInbox::MIME->create( @@ -43,12 +44,14 @@ my @shards = grep(m!/\d+\z!, glob("$ibx->{inboxdir}/xap*/*")); is(scalar(@shards), $nproc - 1, 'got expected shards'); my $orig = $ibx->over->query_xover(1, $ndoc); my %nums = map {; "$_->{num}" => 1 } @$orig; +my $xapian_compact = which('xapian-compact') or + diag("`xapian-compact' missing, unable to test --compact"); # ensure we can go up or down in shards, or stay the same: for my $R (qw(2 4 1 3 3)) { delete $ibx->{search}; # release old handles my $cmd = [@xcpdb, "-R$R", $ibx->{inboxdir}]; - push @$cmd, '--compact' if $R == 1; + push @$cmd, '--compact' if $R == 1 && $xapian_compact; ok(run_script($cmd), "xcpdb -R$R"); my @new_shards = grep(m!/\d+\z!, glob("$ibx->{inboxdir}/xap*/*")); is(scalar(@new_shards), $R, 'resharded to two shards');