File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 1111> ;
1212
1313# args
14- my $cleanup ;
15- GetOptions( " cleanup" => \$cleanup );
14+ my ( $cleanup , $perms_file , $mode );
15+ GetOptions(
16+ " cleanup" => \$cleanup ,
17+ " perms_file=s" => \$perms_file ,
18+ " mode=s" => \$mode ,
19+
20+ );
21+ # TODO: find a better way
22+ $mode eq ' test' and Log::Log4perl::init(' log4perl_test.conf' );
1623
1724# setup
18- my $es = MetaCPAN::ES-> new( type => " permission" );
25+ my $es = MetaCPAN::ES-> new( index => " permission" , ( $mode ? ( mode => $mode ) : () ) );
1926my $bulk = $es -> bulk();
2027
2128my %seen ;
2229log_debug {" building permission data to add" };
2330
24- my $iterator = read_06perms_iter();
31+ my $iterator = read_06perms_iter( $perms_file );
2532while ( my $perms = $iterator -> next_module ) {
2633
2734 # This method does a "return sort @foo", so it can't be called in the
Original file line number Diff line number Diff line change @@ -82,7 +82,15 @@ subtest 'Author Indexing' => sub {
8282 ok( $es_author -> exists ( index => ' author' , id => ' OALDERS' ), " Found author OALDERS" );
8383};
8484
85-
85+ # run the permission indexing script in test mode
86+ my $perms_script = $bin -> child(' permission.pl' );
87+ my $perms_file = $modules -> child(' 06perms.txt' );
88+ ` perl $perms_script -perms_file $perms_file --mode test` ;
89+
90+ subtest ' Permissions Indexing' => sub {
91+ my $es_permission = MetaCPAN::ES-> new( index => ' permission' , mode => ' test' );
92+ ok( $es_permission -> exists ( index => ' permission' , id => ' LWP' ), " Found permissions for LWP" );
93+ };
8694
8795
8896# check test data directory
You can’t perform that action at this time.
0 commit comments