unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@yhbt.net>
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	[thread overview]
Message-ID: <20200401055915.29866-1-e@yhbt.net> (raw)

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');

                 reply	other threads:[~2020-04-01  5:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200401055915.29866-1-e@yhbt.net \
    --to=e@yhbt.net \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).