Skip to content

Commit

Permalink
Return 0/1 explicitly as the client expects it
Browse files Browse the repository at this point in the history
t/ui/10-tests_overview.t was failing under perl 5.40:

    # Subtest: job dependencies displayed on 'Test result overview' page
        ok 1 - job href is shown correctly
        not ok 2 - dependency is shown correctly

        #   Failed test 'dependency is shown correctly'
        #   at t/ui/10-tests_overview.t line 594.
        #          got: '1 parallel parent
        # dependency failed'
        #     expected: '1 parallel parent
        # dependency passed'

In newer perl versions booleans are preserved, and when Mojolicious
sends JSON to the client, it will return it as true.
To support both older and newer versions, we explicitly return 0 or 1.
  • Loading branch information
perlpunk committed Oct 29, 2024
1 parent b96e97b commit bc927f2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/OpenQA/Schema/Result/Jobs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2233,7 +2233,12 @@ sub dependencies ($self, $children_list = undef, $parents_list = undef) {
push(@{$children{$s->to_string}}, $s->child_job_id);
}

return {parents => \%parents, has_parents => $has_parents, parents_ok => $parents_ok, children => \%children};
return {
parents => \%parents,
has_parents => $has_parents,
parents_ok => ($parents_ok ? 1 : 0),
children => \%children,
};
}

sub result_stats ($self) {
Expand Down

0 comments on commit bc927f2

Please sign in to comment.