Bug 33834 - api/v1/ill_requests.t fails randomly
Summary: api/v1/ill_requests.t fails randomly
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low minor (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Testopia
URL:
Keywords:
Depends on: 22440
Blocks:
  Show dependency treegraph
 
Reported: 2023-05-25 13:14 UTC by Tomás Cohen Arazi
Modified: 2023-12-28 20:46 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.07


Attachments
Bug 33834: Fix random failure on api/v1/ill_requests.t (2.96 KB, patch)
2023-05-25 13:18 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 33834: Fix random failure on api/v1/ill_requests.t (3.00 KB, patch)
2023-05-26 00:47 UTC, David Nind
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2023-05-25 13:14:00 UTC
Depending on how results are sorted, it might fail.
Comment 1 Tomás Cohen Arazi 2023-05-25 13:18:23 UTC
Created attachment 151678 [details] [review]
Bug 33834: Fix random failure on api/v1/ill_requests.t

This patch makes the GET request results more deterministic so we avoid
random failures. It does so by adding a fixed value to each ILL request
and then sorting by it.

To test:
1. Run:
   $ DB_IMAGE=mysqli:8.0 ktd up -d
   # wait until it finished:
   $ ktd --logs
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/ill_requests.t
  (repeat a few times)
=> FAIL: It sometimes fails
3. Apply this patch
4. Repeat 2
=> SUCCESS: It doesn't fail
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 David Nind 2023-05-26 00:47:19 UTC
Created attachment 151719 [details] [review]
Bug 33834: Fix random failure on api/v1/ill_requests.t

This patch makes the GET request results more deterministic so we avoid
random failures. It does so by adding a fixed value to each ILL request
and then sorting by it.

To test:
1. Run:
   $ DB_IMAGE=mysqli:8.0 ktd up -d
   # wait until it finished:
   $ ktd --logs
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/ill_requests.t
  (repeat a few times)
=> FAIL: It sometimes fails
3. Apply this patch
4. Repeat 2
=> SUCCESS: It doesn't fail
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Tomás Cohen Arazi 2023-05-26 12:51:18 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 4 Matt Blenkinsop 2023-06-08 17:16:03 UTC
Nice work everyone!

Pushed to stable for 22.11.x