Bug 28670 - api/v1/patrons_holds.t is failing randomly
Summary: api/v1/patrons_holds.t is failing randomly
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 25551
  Show dependency treegraph
 
Reported: 2021-07-06 11:55 UTC by Jonathan Druart
Modified: 2023-06-08 22:32 UTC (History)
3 users (show)

See Also:
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


Attachments
Bug 28670: Prevent api/v1/patrons_holds.t to fail randomly (1.86 KB, patch)
2023-01-18 15:03 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 28670: Prevent api/v1/patrons_holds.t to fail randomly (1.91 KB, patch)
2023-01-18 15:20 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 28670: Prevent api/v1/patrons_holds.t to fail randomly (1.97 KB, patch)
2023-01-18 16:08 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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 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 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 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.