File Coverage

blib/lib/App/Prove/Plugin/Elasticsearch.pm
Criterion Covered Total %
statement 26 26 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 33 33 100.0


line stmt bran cond sub pod time code
1             # PODNAME: App::Prove::Plugin::Elasticsearch
2             # ABSTRACT: Prove Plugin to upload test results to elastic search as they are executed
3              
4             package App::Prove::Plugin::Elasticsearch;
5             $App::Prove::Plugin::Elasticsearch::VERSION = '0.001';
6 1     1   127647 use strict;
  1         12  
  1         22  
7 1     1   5 use warnings;
  1         2  
  1         20  
8              
9 1     1   319 use App::Prove::Elasticsearch::Utils();
  1         3  
  1         137  
10              
11             sub load {
12 2     2 1 2675 my ($class, $prove) = @_;
13              
14 2         5 my $app = $prove->{app_prove};
15 2         5 my $args = $prove->{args};
16              
17 2         7 my $conf = App::Prove::Elasticsearch::Utils::process_configuration($args);
18              
19 2 100       13 if (
20             scalar(
21             grep {
22 2         5 my $subj = $_;
23 2         5 grep { $subj eq $_ } qw{server.host server.port}
  4         16  
24             } keys(%$conf)
25             ) != 2
26             ) {
27 1         21 print
28             "# Insufficient information provided to upload test results to elasticsearch. Skipping...\n";
29 1         7 return $class;
30             }
31              
32 1         8 $app->harness('App::Prove::Elasticsearch::Harness');
33 1         12 $app->merge(1);
34              
35 1         24 my $indexer = App::Prove::Elasticsearch::Utils::require_indexer($conf);
36 1         5 &{\&{$indexer . "::check_index"}}($conf);
  1         8  
  1         10  
37              
38 1         5 return $class;
39             }
40              
41             1;
42              
43             __END__