diff --git a/lib/OpenQA/Schema/Result/Jobs.pm b/lib/OpenQA/Schema/Result/Jobs.pm index 258da35cee5..a1acbc30dc8 100644 --- a/lib/OpenQA/Schema/Result/Jobs.pm +++ b/lib/OpenQA/Schema/Result/Jobs.pm @@ -575,7 +575,8 @@ sub is_ok ($self) { sub is_ok_to_retry ($self) { return 1 unless my $result = $self->result; return 0 if grep { $_ eq $result } OK_RESULTS; # retry is not needed if job is ok - return 0 if $result eq USER_CANCELLED; # retry is not needed if job is user-cancelled + return 0 if $result eq USER_CANCELLED; # retry is not needed if job is user-cancelled... + return 0 if $result eq OBSOLETED; # ...or obsoleted return 1; } diff --git a/t/10-jobs.t b/t/10-jobs.t index d12934b426e..6cc82c7a78a 100644 --- a/t/10-jobs.t +++ b/t/10-jobs.t @@ -831,6 +831,10 @@ subtest 'job setting based retriggering' => sub { $job->done(result => USER_CANCELLED); perform_minion_jobs($minion); is $jobs->count, $jobs_nr + 1, 'no additional job retriggered if USER_CANCELLED (with retry)'; + $job->update({state => SCHEDULED, result => NONE}); + $job->done(result => OBSOLETED); + perform_minion_jobs($minion); + is $jobs->count, $jobs_nr + 1, 'no additional job retriggered if OBSOLETED (with retry)'; my $get_jobs = sub ($task) { $minion->backend->pg->db->query(q{select * from minion_jobs where task = $1 order by id asc}, $task)->hashes; # note: Querying DB directly as `$minion->jobs({tasks => [$task]})` does not return parents.