Bug 28670

Summary: api/v1/patrons_holds.t is failing randomly
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Test SuiteAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, martin.renvoize, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24813
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.02
Circulation function:
Bug Depends on:    
Bug Blocks: 25551    
Attachments: Bug 28670: Prevent api/v1/patrons_holds.t to fail randomly
Bug 28670: Prevent api/v1/patrons_holds.t to fail randomly
Bug 28670: Prevent api/v1/patrons_holds.t to fail randomly

Description Jonathan Druart 2021-07-06 11:55:52 UTC
First time we get this one (Koha_Master/1700):

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.
Comment 2 Jonathan Druart 2023-01-18 13:24:23 UTC
Koha_Master_D10/1003
Comment 3 Jonathan Druart 2023-01-18 14:48:52 UTC
(In reply to Jonathan Druart from comment #2)
> Koha_Master_D10/1003

13:42:30 koha_1       |     #   Failed test 'Holds retrieved'
13:42:30 koha_1       |     #   at t/db_dependent/api/v1/patrons_holds.t line 56.
13:42:30 koha_1       |     #     Structures begin differing at:
13:42:30 koha_1       |     #          $got->[0]{priority} = '3042'
13:47:59 koha_1       |     #     $expected->[0]{priority} = '18716'
13:47:59 koha_1       |     # Looks like you failed 1 test of 9.
13:47:59 koha_1       | 
13:47:59 koha_1       | #   Failed test 'list() tests'
13:47:59 koha_1       | #   at t/db_dependent/api/v1/patrons_holds.t line 70.
Comment 4 Jonathan Druart 2023-01-18 15:03:24 UTC Comment hidden (obsolete)
Comment 5 Owen Leonard 2023-01-18 15:20:03 UTC
Created attachment 145398 [details] [review]
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>
Comment 6 Owen Leonard 2023-01-18 15:20:23 UTC
I'm not able to reproduce the failure but I can confirm that the test passes successfully with the patch.
Comment 7 Martin Renvoize (ashimema) 2023-01-18 16:08:08 UTC
Created attachment 145401 [details] [review]
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>
Comment 8 Martin Renvoize (ashimema) 2023-01-18 16:09:18 UTC
I've seen this before and had no idea why it happened then either.. but I ended up fixing it in the same way.

I think we should push this patch to appease the Jenkins gods but bear it in mind for the future to try and work out why it happens.

Passing QA
Comment 9 Martin Renvoize (ashimema) 2023-01-18 16:10:46 UTC
Nice work everyone!

Pushed to 23.05.x for the next release
Comment 10 Jacob O'Mara 2023-01-18 17:21:21 UTC
Nice work, thanks everyone!

Pushed to 22.11.x for the next release.