jobset-eval: fix actions not showing up sometimes for new jobs

New jobs have their "new" status take precedence over them being
"failed" or "queued", which means actions that can act on "failed" or
"queued" jobs weren't shown to the user when they could only act on
"new" jobs.

(cherry picked from commit 9a4a5dd624)
This commit is contained in:
Pierre Bourdon
2024-07-20 13:09:39 +02:00
committed by ahuston-0
parent fa1e989b7d
commit 17f9920cf9
4 changed files with 29 additions and 18 deletions

View File

@ -25,7 +25,10 @@ subtest "empty diff" => sub {
removed => [],
unfinished => [],
aborted => [],
failed => [],
totalAborted => 0,
totalFailed => 0,
totalQueued => 0,
},
"empty list of jobs returns empty diff"
);
@ -48,12 +51,7 @@ subtest "2 different jobs" => sub {
"succeed_with_failed is a new job"
);
is(scalar(@{$ret->{failed}}), 1, "list of failed jobs is 1 element long");
is(
$ret->{failed}[0]->get_column('id'),
$builds->{"succeed_with_failed"}->get_column('id'),
"succeed_with_failed is a failed job"
);
is($ret->{totalFailed}, 1, "total failed jobs is 1");
is(
$ret->{removed},
@ -70,9 +68,9 @@ subtest "2 different jobs" => sub {
subtest "failed job with no previous history" => sub {
my $ret = buildDiff([$builds->{"fails"}], []);
is(scalar(@{$ret->{failed}}), 1, "list of failed jobs is 1 element long");
is($ret->{totalFailed}, 1, "total failed jobs is 1");
is(
$ret->{failed}[0]->get_column('id'),
$ret->{new}[0]->get_column('id'),
$builds->{"fails"}->get_column('id'),
"fails is a failed job"
);
@ -93,7 +91,6 @@ subtest "not-yet-built job with no previous history" => sub {
is($ret->{removed}, [], "removed");
is($ret->{unfinished}, [], "unfinished");
is($ret->{aborted}, [], "aborted");
is($ret->{failed}, [], "failed");
is(scalar(@{$ret->{new}}), 1, "list of new jobs is 1 element long");
is(