Skip to content

Commit

Permalink
Fix synchronization of TODO with badges
Browse files Browse the repository at this point in the history
* First introduced with fe2fa2b
* All softfails except ones with unreviewed failed modules
  are filtered out

See https://progress.opensuse.org/issues/17172
  • Loading branch information
Martchus committed Mar 2, 2017
1 parent 673425d commit c8b45e8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/OpenQA/WebAPI/Controller/Test.pm
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,8 @@ sub prepare_job_results {
if $job->result eq OpenQA::Schema::Result::Jobs::PASSED
|| $job_labels->{$jobid}{bugs}
|| $job_labels->{$jobid}{label}
|| ( $job->result eq OpenQA::Schema::Result::Jobs::SOFTFAILED
&& $job->has_failed_modules);
|| ($job->result eq OpenQA::Schema::Result::Jobs::SOFTFAILED
&& ($job_labels->{$jobid}{label} || !$job->has_failed_modules));
}

$result = {
Expand Down
33 changes: 29 additions & 4 deletions t/10-tests_overview.t
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ $get->element_exists_not('#res_DVD_x86_64_kde .result_passed');

$form = {distri => 'opensuse', version => 'Factory', build => '0048', todo => 1};
$get = $t->get_ok('/tests/overview' => form => $form)->status_is(200);
like(get_summary, qr/Passed: 0 Soft Failure: 2 Failed: 1/i, 'todo=1 shows all unlabeled failed');
like(
get_summary,
qr/Passed: 0 Failed: 1/i,
'todo=1 shows only unlabeled left failed as softfailed with failing modules was labeled'
);

# add a failing module to one of the softfails to test 'TODO' option
my $failing_module = $t->app->db->resultset('JobModules')->create(
Expand All @@ -166,9 +170,30 @@ my $failing_module = $t->app->db->resultset('JobModules')->create(

$get = $t->get_ok('/tests/overview' => form => {distri => 'opensuse', version => 'Factory', build => '0048', todo => 1})
->status_is(200);
like(get_summary, qr/Passed: 0 Soft Failure: 1 Failed: 1/i, 'todo=1 shows all unlabeled failed');
$t->element_exists('#res-99939', 'softfailed without failing module present');
$t->element_exists_not('#res-99936', 'softfailed with failing module filtered out');
like(
get_summary,
qr/Passed: 0 Soft Failure: 1 Failed: 1/i,
'todo=1 shows only unlabeled left failed as softfailed with failing modules was labeled'
);
$t->element_exists_not('#res-99939', 'softfailed without failing module filtered out');
$t->element_exists('#res-99936', 'softfailed with unreviewed failing module present');

my $review_comment = $t->app->db->resultset('Comments')->create(
{
job_id => 99936,
text => 'bsc#1234',
user_id => 99903,
});
$get = $t->get_ok('/tests/overview' => form => {distri => 'opensuse', version => 'Factory', build => '0048', todo => 1})
->status_is(200);
like(
get_summary,
qr/Passed: 0 Failed: 1/i,
'todo=1 shows only unlabeled left failed as softfailed with failing modules was labeled'
);
$t->element_exists_not('#res-99936', 'softfailed with reviewed failing module filtered out');

$review_comment->delete();
$failing_module->delete();

# multiple groups can be shown at the same time
Expand Down

0 comments on commit c8b45e8

Please sign in to comment.