diff --git a/corpus/Provides-NoFile-0.50.tar.gz b/corpus/Provides-NoFile-0.50.tar.gz deleted file mode 100644 index e38eb5721..000000000 Binary files a/corpus/Provides-NoFile-0.50.tar.gz and /dev/null differ diff --git a/t/lib/PAUSE/TestPAUSE.pm b/t/lib/PAUSE/TestPAUSE.pm index 3af92670e..05d498149 100644 --- a/t/lib/PAUSE/TestPAUSE.pm +++ b/t/lib/PAUSE/TestPAUSE.pm @@ -352,9 +352,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; @@ -390,22 +389,11 @@ sub test_reindex { my $existing_log_events = $self->logger->events->@*; - if ($arg->{pick}) { - my $dbh = PAUSE::dbh(); - $dbh->do("DELETE FROM distmtimes WHERE dist = ?", undef, $_) - for @{ $arg->{pick} }; - } - my $package_file = $self->tmpdir->child(qw(cpan modules 02packages.details.txt.gz)); my $old_package_state = -f $package_file ? $package_file->digest : ''; - PAUSE::mldistwatch->new({ - sleep => 0, - ($arg->{pick} ? (pick => $arg->{pick}) : ()), - })->reindex; - - $arg->{after}->($self->tmpdir) if $arg->{after}; + $action->(); # The first $existing_log_events were already there. We only care about # ones added during the indexer run. @@ -430,6 +418,38 @@ 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; + + $arg->{after}->($self->tmpdir) if $arg->{after}; + }; + + return $self->_take_pause_action($action); +} + sub run_shell { my ($self) = @_; diff --git a/t/mldistwatch-big.t b/t/mldistwatch-big.t index 38a43b2cc..dfc0f3110 100644 --- a/t/mldistwatch-big.t +++ b/t/mldistwatch-big.t @@ -1,7 +1,7 @@ use strict; use warnings; -use 5.10.1; +use v5.36.0; use lib 't/lib'; use lib 't/privatelib'; # Stub PrivatePAUSE @@ -250,12 +250,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 ($meta, @) { + $meta->{provides} = { + "Provides::NoFile" => { file => "lib/Provides/NoFile.pm", version => "1.5" }, + "Provides::NoFile::Nowhere" => { file => undef }, + }; + + return $meta; + }, + } + ); my $result = $pause->test_reindex;