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 11
11
> ;
12
12
13
13
# 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' );
16
23
17
24
# setup
18
- my $es = MetaCPAN::ES-> new( type => " permission" );
25
+ my $es = MetaCPAN::ES-> new( index => " permission" , ( $mode ? ( mode => $mode ) : () ) );
19
26
my $bulk = $es -> bulk();
20
27
21
28
my %seen ;
22
29
log_debug {" building permission data to add" };
23
30
24
- my $iterator = read_06perms_iter();
31
+ my $iterator = read_06perms_iter( $perms_file );
25
32
while ( my $perms = $iterator -> next_module ) {
26
33
27
34
# 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 {
82
82
ok( $es_author -> exists ( index => ' author' , id => ' OALDERS' ), " Found author OALDERS" );
83
83
};
84
84
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
+ };
86
94
87
95
88
96
# check test data directory
You can’t perform that action at this time.
0 commit comments