line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Associate Test results with a tracked defect |
2
|
|
|
|
|
|
|
# PODNAME: App::ape::update |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package App::ape::update; |
5
|
|
|
|
|
|
|
$App::ape::update::VERSION = '0.001'; |
6
|
3
|
|
|
3
|
|
83952
|
use strict; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
70
|
|
7
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
69
|
|
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
636
|
use Getopt::Long qw{GetOptionsFromArray}; |
|
3
|
|
|
|
|
7930
|
|
|
3
|
|
|
|
|
17
|
|
10
|
3
|
|
|
3
|
|
713
|
use App::Prove::Elasticsearch::Utils; |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
86
|
|
11
|
3
|
|
|
3
|
|
456
|
use Pod::Usage; |
|
3
|
|
|
|
|
35905
|
|
|
3
|
|
|
|
|
1102
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
4
|
|
|
4
|
1
|
105
|
my ($class, @args) = @_; |
15
|
|
|
|
|
|
|
|
16
|
4
|
|
|
|
|
9
|
my (%options, @conf, $help); |
17
|
|
|
|
|
|
|
GetOptionsFromArray( |
18
|
|
|
|
|
|
|
\@args, |
19
|
|
|
|
|
|
|
'defect=s@' => \$options{defects}, |
20
|
|
|
|
|
|
|
'platform=s@' => \$options{platforms}, |
21
|
|
|
|
|
|
|
'version=s@' => \$options{versions}, |
22
|
|
|
|
|
|
|
'configure=s@' => \@conf, |
23
|
|
|
|
|
|
|
'status=s' => \$options{status}, |
24
|
4
|
|
|
|
|
30
|
'help' => \$help |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
4
|
|
100
|
|
|
1957
|
$options{defects} //= []; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#Deliberately exiting here, as I "unit" test this as the binary |
30
|
4
|
50
|
|
|
|
10
|
pod2usage(0) if $help; |
31
|
|
|
|
|
|
|
|
32
|
4
|
100
|
|
|
|
8
|
if (!scalar(@args)) { |
33
|
1
|
|
|
|
|
9
|
pod2usage( |
34
|
|
|
|
|
|
|
-exitval => "NOEXIT", |
35
|
|
|
|
|
|
|
-msg => "Insufficient arguments. You must pass at least one test.", |
36
|
|
|
|
|
|
|
); |
37
|
1
|
|
|
|
|
2380
|
return 1; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
3
|
100
|
|
|
|
5
|
if (!scalar(@{$options{defects}})) { |
|
3
|
|
|
|
|
10
|
|
41
|
1
|
|
|
|
|
5
|
pod2usage( |
42
|
|
|
|
|
|
|
-exitval => "NOEXIT", |
43
|
|
|
|
|
|
|
-msg => |
44
|
|
|
|
|
|
|
"Insufficient arguments. You must pass at least one defect.", |
45
|
|
|
|
|
|
|
); |
46
|
1
|
|
|
|
|
1997
|
return 4; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
2
|
|
|
|
|
5
|
my $conf = App::Prove::Elasticsearch::Utils::process_configuration(@conf); |
50
|
|
|
|
|
|
|
|
51
|
2
|
100
|
|
|
|
13
|
if ( |
52
|
|
|
|
|
|
|
scalar( |
53
|
|
|
|
|
|
|
grep { |
54
|
2
|
|
|
|
|
3
|
my $subj = $_; |
55
|
2
|
|
|
|
|
3
|
grep { $subj eq $_ } qw{server.host server.port} |
|
4
|
|
|
|
|
8
|
|
56
|
|
|
|
|
|
|
} keys(%$conf) |
57
|
|
|
|
|
|
|
) != 2 |
58
|
|
|
|
|
|
|
) { |
59
|
1
|
|
|
|
|
4
|
pod2usage( |
60
|
|
|
|
|
|
|
-exitval => "NOEXIT", |
61
|
|
|
|
|
|
|
-msg => |
62
|
|
|
|
|
|
|
"Insufficient information provided to associate defect with test results to elasticsearch", |
63
|
|
|
|
|
|
|
); |
64
|
1
|
|
|
|
|
1808
|
return 3; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
4
|
my $self = {options => \%options, cases => \@args}; |
68
|
|
|
|
|
|
|
|
69
|
1
|
|
|
|
|
2
|
$self->{indexer} = App::Prove::Elasticsearch::Utils::require_indexer($conf); |
70
|
1
|
|
|
|
|
4
|
&{\&{$self->{indexer} . "::check_index"}}($conf); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
71
|
|
|
|
|
|
|
|
72
|
1
|
|
|
|
|
5
|
return bless($self, $class); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub run { |
76
|
1
|
|
|
1
|
1
|
1194
|
my $self = shift; |
77
|
1
|
|
|
|
|
3
|
my $global_result = 0; |
78
|
1
|
|
|
|
|
3
|
foreach my $case (@{$self->{cases}}) { |
|
1
|
|
|
|
|
4
|
|
79
|
1
|
|
|
|
|
4
|
$self->{options}{case} = $case; |
80
|
|
|
|
|
|
|
$global_result += |
81
|
1
|
|
|
|
|
3
|
&{\&{$self->{indexer} . "::associate_case_with_result"}} |
|
1
|
|
|
|
|
8
|
|
82
|
1
|
|
|
|
|
3
|
(%{$self->{options}}); |
|
1
|
|
|
|
|
4
|
|
83
|
|
|
|
|
|
|
} |
84
|
1
|
50
|
|
|
|
18
|
print "$global_result tests failed to be associated, examine above output\n" |
85
|
|
|
|
|
|
|
if $global_result; |
86
|
1
|
50
|
|
|
|
10
|
return $global_result ? 2 : 0; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
__END__ |