| 1 | package Tapper::Schema::TestrunDB::ResultSet::Testrun; | ||||||||||||||||||||||
| 2 | 10 | our $AUTHORITY = 'cpan:TAPPER'; | |||||||||||||||||||||
| 3 | 10 | $Tapper::Schema::TestrunDB::ResultSet::Testrun::VERSION = '5.0.12'; | |||||||||||||||||||||
| 4 | 10 | ▶ | use strict; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 5 | 10 | ▶ | use warnings; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 6 | |||||||||||||||||||||||
| 7 | 10 | ▶ | use parent 'DBIx::Class::ResultSet'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 8 | |||||||||||||||||||||||
| 9 | |||||||||||||||||||||||
| 10 | sub queued_testruns | ||||||||||||||||||||||
| 11 | 1 | ▶ | { | ||||||||||||||||||||
|
Subroutine
queued_testruns: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 12 | shift->search({ | ||||||||||||||||||||||
| 13 | 1 | starttime_testrun => undef, | |||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||
| 15 | ); | ||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||
| 17 | |||||||||||||||||||||||
| 18 | |||||||||||||||||||||||
| 19 | sub running_testruns | ||||||||||||||||||||||
| 20 | 1 | ▶ | { | ||||||||||||||||||||
|
Subroutine
running_testruns: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 21 | shift->search({ | ||||||||||||||||||||||
| 22 | 1 | starttime_testrun => { '!=' => undef }, | |||||||||||||||||||||
| 23 | endtime_test_program => undef, | ||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||
| 25 | ); | ||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||
| 27 | |||||||||||||||||||||||
| 28 | |||||||||||||||||||||||
| 29 | sub finished_testruns | ||||||||||||||||||||||
| 30 | 0 | ▶ | { | ||||||||||||||||||||
|
Subroutine
finished_testruns: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||
| 31 | shift->search({ | ||||||||||||||||||||||
| 32 | 0 | endtime_test_program => { '!=' => undef }, | |||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||
| 34 | ); | ||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||
| 36 | |||||||||||||||||||||||
| 37 | |||||||||||||||||||||||
| 38 | sub due_testruns | ||||||||||||||||||||||
| 39 | 1 | ▶ | { | ||||||||||||||||||||
|
Subroutine
due_testruns: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 40 | 1 | my ($self) = @_; | |||||||||||||||||||||
| 41 | |||||||||||||||||||||||
| 42 | 1 | require DateTime; | |||||||||||||||||||||
| 43 | 1 | my $now = $self->result_source->storage->datetime_parser->format_datetime(DateTime->now); | |||||||||||||||||||||
| 44 | 1 | return $self->search( | |||||||||||||||||||||
| 45 | { | ||||||||||||||||||||||
| 46 | starttime_earliest => { '<', $now}, | ||||||||||||||||||||||
| 47 | starttime_testrun => undef, | ||||||||||||||||||||||
| 48 | }, | ||||||||||||||||||||||
| 49 | { | ||||||||||||||||||||||
| 50 | order_by => [qw/starttime_earliest/] | ||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||
| 52 | ); | ||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||
| 54 | |||||||||||||||||||||||
| 55 | |||||||||||||||||||||||
| 56 | 1 | ▶ | sub all_testruns { | ||||||||||||||||||||
|
Subroutine
all_testruns: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 57 | 1 | shift->search({}); | |||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||
| 59 | |||||||||||||||||||||||
| 60 | |||||||||||||||||||||||
| 61 | 1 | ▶ | sub status { | ||||||||||||||||||||
|
Subroutine
status: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 62 | 1 | shift->search({'testrun_scheduling.status' => $_[0]}, {join => 'testrun_scheduling'}); | |||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||
| 64 | |||||||||||||||||||||||
| 65 | |||||||||||||||||||||||
| 66 | 1 | ▶ | sub add { | ||||||||||||||||||||
|
Subroutine
add: called CC=6 SCAR=18.5
Pod
documented
| |||||||||||||||||||||||
| 67 | 1 | my ($self, $args) = @_; | |||||||||||||||||||||
| 68 | |||||||||||||||||||||||
| 69 | my $testrun = $self->new | ||||||||||||||||||||||
| 70 | ({ | ||||||||||||||||||||||
| 71 | testplan_id => $args->{testplan_id}, | ||||||||||||||||||||||
| 72 | notes => $args->{notes}, | ||||||||||||||||||||||
| 73 | shortname => $args->{shortname}, | ||||||||||||||||||||||
| 74 | topic_name => $args->{topic_name}, | ||||||||||||||||||||||
| 75 | starttime_earliest => $args->{earliest}, | ||||||||||||||||||||||
| 76 | owner_id => $args->{owner_id}, | ||||||||||||||||||||||
| 77 | rerun_on_error => $args->{rerun_on_error}, | ||||||||||||||||||||||
| 78 | wait_after_tests => $args->{wait_after_tests}, | ||||||||||||||||||||||
| 79 | 1 | }); | |||||||||||||||||||||
| 80 | |||||||||||||||||||||||
| 81 | 1 | $testrun->insert; | |||||||||||||||||||||
| 82 | |||||||||||||||||||||||
| 83 | |||||||||||||||||||||||
| 84 | my $testrunscheduling = $self->result_source->schema->resultset('TestrunScheduling')->new | ||||||||||||||||||||||
| 85 | ({ | ||||||||||||||||||||||
| 86 | testrun_id => $testrun->id, | ||||||||||||||||||||||
| 87 | queue_id => $args->{queue_id}, | ||||||||||||||||||||||
| 88 | host_id => $args->{host_id}, | ||||||||||||||||||||||
| 89 | status => $args->{status} || "schedule", | ||||||||||||||||||||||
| 90 | 1 | ▶ | auto_rerun => $args->{auto_rerun} || 0, | ||||||||||||||||||||
|
Condition50%2/4
$args->{'status'} || 'schedule'
$args->{'auto_rerun'} || 0
MC/DC0%0/1
$args->{'status'} || 'schedule'
$args->{'status'}
MC/DC0%0/1
$args->{'auto_rerun'} || 0
$args->{'auto_rerun'}
Truth table50%1/2
A
A= $args->{'status'}
Truth table50%1/2
A
A= $args->{'auto_rerun'}
| |||||||||||||||||||||||
| 91 | }); | ||||||||||||||||||||||
| 92 | 1 | ▶ | if ($args->{priority}) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 93 | 0 | $testrunscheduling->prioqueue_seq($self->result_source->schema->resultset('TestrunScheduling')->max_priority_seq()+1); | |||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||
| 95 | |||||||||||||||||||||||
| 96 | 1 | $testrunscheduling->insert; | |||||||||||||||||||||
| 97 | |||||||||||||||||||||||
| 98 | 1 | ▶ | if ($args->{scenario_id}) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 99 | my $scenario_element = $self->result_source->schema->resultset('ScenarioElement')->new | ||||||||||||||||||||||
| 100 | ({ | ||||||||||||||||||||||
| 101 | scenario_id => $args->{scenario_id}, | ||||||||||||||||||||||
| 102 | 1 | testrun_id => $testrun->id, | |||||||||||||||||||||
| 103 | }); | ||||||||||||||||||||||
| 104 | 1 | $scenario_element->insert; | |||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||
| 106 | |||||||||||||||||||||||
| 107 | 1 | foreach my $host_id(@{$args->{requested_host_ids}}) { | |||||||||||||||||||||
| 108 | 3 | my $requested_host = $self->result_source->schema->resultset('TestrunRequestedHost')->new | |||||||||||||||||||||
| 109 | ({ | ||||||||||||||||||||||
| 110 | host_id => $host_id, | ||||||||||||||||||||||
| 111 | testrun_id => $testrun->id, | ||||||||||||||||||||||
| 112 | }); | ||||||||||||||||||||||
| 113 | 3 | $requested_host->insert; | |||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||
| 115 | |||||||||||||||||||||||
| 116 | 1 | return $testrun->id; | |||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||
| 118 | |||||||||||||||||||||||
| 119 | 10 | 1; | |||||||||||||||||||||
| 120 | |||||||||||||||||||||||
| 121 | __END__ | ||||||||||||||||||||||