Bug 28670: Prevent api/v1/patrons_holds.t to fail randomly

12:01:12 koha_1       |     #   Failed test 'Holds retrieved'
12:01:12 koha_1       |     #   at t/db_dependent/api/v1/patrons_holds.t line 56.
12:01:12 koha_1       |     #     Structures begin differing at:
12:01:12 koha_1       |     #          $got->[0]{hold_id} = '256'
12:01:12 koha_1       |     #     $expected->[0]{hold_id} = '255'
12:01:12 koha_1       |     # Looks like you failed 1 test of 9.
12:01:12 koha_1       |
12:01:12 koha_1       | #   Failed test 'list() tests'
12:01:12 koha_1       | #   at t/db_dependent/api/v1/patrons_holds.t line 70.

This is a weird one, and the only solution I see it to force the order
we want to receive the holds.

I guess we should not rely on an order if no order by clause is passed

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit afcf0c95b4)
Signed-off-by: Jacob O'Mara <jacob.omara@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2023-01-18 15:55:26 +01:00 committed by Jacob O'Mara
parent 472aad196d
commit eb2fbe6dd6
1 changed files with 1 additions and 1 deletions

View File

@ -53,7 +53,7 @@ subtest 'list() tests' => sub {
my $hold_1 = $builder->build_object({ class => 'Koha::Holds', value => { borrowernumber => $patron->id } });
my $hold_2 = $builder->build_object({ class => 'Koha::Holds', value => { borrowernumber => $patron->id } });
$t->get_ok("//$userid:$password@/api/v1/patrons/" . $patron->id . '/holds')
$t->get_ok("//$userid:$password@/api/v1/patrons/" . $patron->id . '/holds?_order_by=+me.hold_id')
->status_is( 200, 'SWAGGER3.2.2' )
->json_is( '' => [ $hold_1->to_api, $hold_2->to_api ], 'Holds retrieved' );