};
require './t/common.perl';
require_git('2.6');
-use File::Temp qw/tempdir/;
use PublicInbox::MIME;
use PublicInbox::InboxWritable;
);
my ($this) = (split('/', $0))[-1];
-my $tmpdir = tempdir($this.'-XXXXXX', TMPDIR => 1, CLEANUP => 1);
+my ($tmpdir, $for_destroy) = tmpdir();
+local $ENV{PI_CONFIG} = "$tmpdir/config";
my $ibx = PublicInbox::Inbox->new({
inboxdir => "$tmpdir/testbox",
name => $this,
# 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
- ok(run_script([@xcpdb, "-R$R", $ibx->{inboxdir}]), "xcpdb -R$R");
+ my $cmd = [@xcpdb, "-R$R", $ibx->{inboxdir}];
+ push @$cmd, '--compact' if $R == 1;
+ 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');
my $msgs = $ibx->search->query('s:this');