From a3851a68f8447021838a3fbdca96e59797020903 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 18 Jan 2023 15:55:26 +0100 Subject: [PATCH] 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 --- t/db_dependent/api/v1/patrons_holds.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/db_dependent/api/v1/patrons_holds.t b/t/db_dependent/api/v1/patrons_holds.t index e18de8cae5..523963b81f 100755 --- a/t/db_dependent/api/v1/patrons_holds.t +++ b/t/db_dependent/api/v1/patrons_holds.t @@ -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' ); -- 2.20.1