+
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed corpus/Provides-NoFile-0.50.tar.gz
Binary file not shown.
46 changes: 31 additions & 15 deletions t/lib/PAUSE/TestPAUSE.pm
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,8 @@ sub with_our_config {
$code->($self);
}

sub test_reindex {
my ($self, $arg) = @_;
$arg //= {};
sub _take_pause_action {
my ($self, $action) = @_;

$self->with_our_config(sub {
my $self = shift;
Expand Down Expand Up @@ -349,18 +348,7 @@ sub test_reindex {

die "stray mail in test mail trap before reindex" if @stray_mail;

if ($arg->{pick}) {
my $dbh = PAUSE::dbh();
$dbh->do("DELETE FROM distmtimes WHERE dist = ?", undef, $_)
for @{ $arg->{pick} };
}

PAUSE::mldistwatch->new({
sleep => 0,
($arg->{pick} ? (pick => $arg->{pick}) : ()),
})->reindex;

$arg->{after}->($self->tmpdir) if $arg->{after};
$action->();

my @deliveries = Email::Sender::Simple->default_transport->deliveries;

Expand All @@ -376,6 +364,34 @@ sub test_reindex {
});
}

sub rewrite_indexes {
my ($self) = @_;
my $action = sub {
PAUSE::mldistwatch->new({ sleep => 0 })->rewrite_indexes;
};

return $self->_take_pause_action($action);
}

sub test_reindex {
my ($self, $arg) = @_;
$arg //= {};
my $action = sub {
if ($arg->{pick}) {
my $dbh = PAUSE::dbh();
$dbh->do("DELETE FROM distmtimes WHERE dist = ?", undef, $_)
for @{ $arg->{pick} };
}

PAUSE::mldistwatch->new({
sleep => 0,
($arg->{pick} ? (pick => $arg->{pick}) : ()),
})->reindex;
};

return $self->_take_pause_action($action);
}

has _file_index => (
is => 'ro',
default => sub { {} },
Expand Down
19 changes: 13 additions & 6 deletions t/mldistwatch-big.t
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,19 @@ subtest "case mismatch, authorized for original, desc. version" => sub {
subtest "sometimes, provides fields are empty" => sub {
my $pause = PAUSE::TestPAUSE->init_new;

# Key points:
# 1. dist version 0.50
# 2. meta provides has...
# a. package Provides::NoFile in a named file with version 1.5
# b. package Provides::NoFile::Nowhere with an undef file entry
$pause->upload_author_file(MYSTERIO => 'corpus/Provides-NoFile-0.50.tar.gz');
$pause->upload_author_fake(
MYSTERIO => 'Provides-NoFile-0.50.tar.gz',
{
meta_munger => sub {
$_[0]{provides} = {
"Provides::NoFile" => { file => "lib/Provides/NoFile.pm", version => "1.5" },
"Provides::NoFile::Nowhere" => { file => undef },
};

return $_[0];
},
}
);

my $result = $pause->test_reindex;

Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载