Skip to content

Commit

Permalink
Merge pull request #3991 from Martchus/carry-over-2
Browse files Browse the repository at this point in the history
Take test modules without result into account for carry-over
  • Loading branch information
mergify[bot] committed Jul 1, 2021
2 parents 597771a + e93c119 commit b8a7c9d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lib/OpenQA/Schema/Result/Jobs.pm
Expand Up @@ -1767,15 +1767,18 @@ sub _previous_scenario_jobs {
return $schema->resultset("Jobs")->search({-and => $conds}, \%attrs)->all;
}

sub _relevant_module_result_for_carry_over_evaluation ($module_result) {
$module_result eq FAILED || $module_result eq SOFTFAILED || $module_result eq NONE;
}

# internal function to compare two failure reasons
sub _failure_reason {
my ($self) = @_;

my %failed_modules;
my $modules = $self->modules;
while (my $m = $modules->next) {
my $module_result = $m->result;
next unless $module_result eq FAILED || $module_result eq SOFTFAILED;
next unless _relevant_module_result_for_carry_over_evaluation my $module_result = $m->result;
# look for steps which reference a bug within the title to use it as failure reason (instead of the module name)
# note: This allows the carry-over to happen if the same bug is found via different test modules.
my $details = ($m->results(skip_text_data => 1) // {})->{details};
Expand Down
4 changes: 2 additions & 2 deletions t/17-labels_carry_over.t
Expand Up @@ -155,10 +155,10 @@ subtest 'failed in different modules with same bugref in details' => sub {
is join('', @{comments('/tests/99963')}), $comment_must, 'label is carried over without other failing modules';
};

subtest 'failure reason still computed without results' => sub {
subtest 'failure reason still computed without results, modules without results taken into account' => sub {
my $mock = Test::MockModule->new('OpenQA::Schema::Result::JobModules');
$mock->redefine(results => undef);
is $curr_job->_failure_reason, 'aplay:failed,yast2_lan:failed', 'failure reason computed';
like $curr_job->_failure_reason, qr/amarok:none,aplay:failed,.*yast2_lan:failed,.*zypper_up:none/, 'failure reason';
};

done_testing;

0 comments on commit b8a7c9d

Please sign in to comment.