Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

simple-but-useful test that mldistwatch actually works

...including the import of a fakecpan from fakecpan.org
  • Loading branch information...
commit 6905d15a0e6cbc1d7669be644b0b3c43331de454 1 parent e6b19cd
@rjbs rjbs authored
View
BIN  corpus/authors/O/OP/OPRIME/Bug-Gold-9.001.tar.gz
Binary file not shown
View
5 corpus/authors/O/OP/OPRIME/Bug-Gold-9.001/MANIFEST
@@ -0,0 +1,5 @@
+MANIFEST
+lib/Bug/Gold.pm
+Makefile.PL
+META.yml
+t/00-nop.t
View
11 corpus/authors/O/OP/OPRIME/Bug-Gold-9.001/META.yml
@@ -0,0 +1,11 @@
+---
+name: Bug-Gold
+version: 9.001
+abstract: the Bug-Gold dist
+author:
+ - OPRIME <OPRIME@cpan.local>
+generated_by: Module::Faker version
+license: unknown
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.3.html
+ version: 1.3
View
10 corpus/authors/O/OP/OPRIME/Bug-Gold-9.001/Makefile.PL
@@ -0,0 +1,10 @@
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ DISTNAME => "Bug-Gold",
+ NAME => "Bug::Gold",
+ VERSION => "9.001",
+ ABSTRACT => 'the Bug-Gold dist',
+ PREREQ_PM => {
+ },
+);
View
3  corpus/authors/O/OP/OPRIME/Bug-Gold-9.001/lib/Bug/Gold.pm
@@ -0,0 +1,3 @@
+package Bug::Gold;
+our $VERSION = '9.001';
+1
View
3  corpus/authors/O/OP/OPRIME/Bug-Gold-9.001/t/00-nop.t
@@ -0,0 +1,3 @@
+#!perl
+use Test::More tests => 1;
+ok(1);
View
19 corpus/authors/O/OP/OPRIME/CHECKSUMS
@@ -0,0 +1,19 @@
+# CHECKSUMS file written on Mon Apr 18 10:35:22 2011 GMT by CPAN::Checksums (v2.07)
+$cksum = {
+ 'Bug-Gold-9.001.tar.gz' => {
+ 'md5' => 'a450f562155ff2173923d42dd34b5277',
+ 'md5-ungz' => '6b3b44272f49c8f3cd5b9972dd48cce3',
+ 'mtime' => '2011-04-18',
+ 'sha256' => '168e272bc72c4e80afbbbcac9746b816c3922742a504a8449ff112063ceb0204',
+ 'sha256-ungz' => 'e2d3b15d1c0418bd0209f0a32f070698ea8a36f999f6b20a5dd91a33638440d7',
+ 'size' => 660
+ },
+ 'XForm-Rollout-1.00.tar.gz' => {
+ 'md5' => 'a2d5abfc9065cb4dde779cf0e3867a2a',
+ 'md5-ungz' => '8e7cb18710dc9ef63e063e59105b6c7d',
+ 'mtime' => '2011-04-18',
+ 'sha256' => 'ab2498b621f6280b722a204b5d01dc751cebd5caf5da0b8965c741ff91daeb20',
+ 'sha256-ungz' => '0c20be27b5400fbae08fcbc594c0ee3f118867f5f91bb17bc09612d8ab3dff61',
+ 'size' => 667
+ }
+};
View
BIN  corpus/authors/O/OP/OPRIME/XForm-Rollout-1.00.tar.gz
Binary file not shown
View
19 corpus/authors/X/XY/XYZZY/CHECKSUMS
@@ -0,0 +1,19 @@
+# CHECKSUMS file written on Mon Apr 18 10:35:22 2011 GMT by CPAN::Checksums (v2.07)
+$cksum = {
+ 'Hall-MtKing-0.01.tar.gz' => {
+ 'md5' => '4a7a096a0f85d717cffe57e1add2592c',
+ 'md5-ungz' => '0fc12384000e64aa1a03ed36c3aa9b8e',
+ 'mtime' => '2011-04-18',
+ 'sha256' => '26c11d15b2d7925475a05ceca9b4de2904b1b6ac352c2feafb8ec8dc9f5c3251',
+ 'sha256-ungz' => '3f55081c7d405ac037123c3e0715d9d6846c40aaa544f5d4e14c71bfd53e30e4',
+ 'size' => 664
+ },
+ 'Y-2.tar.gz' => {
+ 'md5' => 'f273778a0815e56a07b875846c92293a',
+ 'md5-ungz' => 'b6e50104e74e8b7dbf470cc469af6979',
+ 'mtime' => '2011-04-18',
+ 'sha256' => '231ed0327e2fb2a3a26824f23d6718eb1576d98c22839a89eddd73c285e373b4',
+ 'sha256-ungz' => '975fd51333d684b13c9bcea133679153cd79313665e633de8ae7c45e9ac539d4',
+ 'size' => 623
+ }
+};
View
BIN  corpus/authors/X/XY/XYZZY/Hall-MtKing-0.01.tar.gz
Binary file not shown
View
BIN  corpus/authors/X/XY/XYZZY/Y-2.tar.gz
Binary file not shown
View
69 t/lib/PAUSE/TestPAUSE.pm
@@ -0,0 +1,69 @@
+package PAUSE::TestPAUSE;
+use Moose;
+use MooseX::StrictConstructor;
+
+use File::Path qw(make_path);
+use File::Temp ();
+use File::Copy::Recursive qw(dircopy);
+
+use PAUSE;
+use PAUSE::mldistwatch;
+
+use namespace::autoclean;
+
+has author_root => (
+ is => 'ro',
+ isa => 'Str',
+ required => 1,
+);
+
+sub deploy_schemas_at {
+ my ($self, $dir) = @_;
+
+ # DESPERATELY EVIL -- rjbs, 2011-08-13
+ `sqlite3 "$dir/authen.sqlite" < doc/schemas/authen_pause.schema.sqlite`;
+ `sqlite3 "$dir/mod.sqlite" < doc/schemas/mod.schema.sqlite`;
+}
+
+sub test {
+ my ($self, $code) = @_;
+
+ my $tmpdir = File::Temp->newdir;
+
+ my $cpan_root = File::Spec->catdir($tmpdir, 'cpan');
+ my $ml_root = File::Spec->catdir($cpan_root, qw(authors id));
+
+ make_path( File::Spec->catdir($cpan_root, 'modules') );
+
+ dircopy($self->author_root, $ml_root);
+
+ mkdir File::Spec->catdir($tmpdir, 'db');
+ my $db_root = File::Spec->catdir($tmpdir, 'db');
+ my $dsnbase = "DBI:SQLite:dbname=$db_root";
+
+ local $PAUSE::Config->{AUTHEN_DATA_SOURCE_NAME} = "$dsnbase/authen.sqlite";
+ local $PAUSE::Config->{MOD_DATA_SOURCE_NAME} = "$dsnbase/mod.sqlite";
+
+ $self->deploy_schemas_at($db_root);
+
+ local $PAUSE::Config->{MLROOT} = File::Spec->catdir($ml_root);
+
+ local $PAUSE::Config->{PID_DIR} = File::Spec->catdir($tmpdir, 'run');
+ mkdir $PAUSE::Config->{PID_DIR};
+
+ local $PAUSE::Config->{ML_MIN_FILES} = 1;
+ local $PAUSE::Config->{ML_MIN_INDEX_LINES} = 1;
+
+ local $PAUSE::Config->{ML_CHOWN_USER} = +(getpwuid($>))[0];
+ local $PAUSE::Config->{ML_CHOWN_GROUP} = +(getgrgid($)))[0];
+
+ local $PAUSE::Config->{ML_MAILER} = 'testfile';
+
+ PAUSE::mldistwatch->new->reindex;
+
+ $code->($tmpdir) if $code;
+
+ return $tmpdir;
+}
+
+1;
View
21 t/mldistwatch.t
@@ -0,0 +1,21 @@
+use strict;
+use warnings;
+
+use lib 't/lib';
+
+use File::Spec;
+use PAUSE;
+use PAUSE::TestPAUSE;
+
+use Test::More;
+
+my $tmpdir = PAUSE::TestPAUSE->new({
+ author_root => 'corpus/authors',
+})->test;
+
+ok(
+ -e File::Spec->catfile($tmpdir, qw(cpan modules 02packages.details.txt.gz)),
+ "our indexer indexed",
+);
+
+done_testing;

0 comments on commit 6905d15

Please sign in to comment.
Something went wrong with that request. Please try again.