Bug 33054 - Koha/Acquisition/Order.t is failing randomly
Summary: Koha/Acquisition/Order.t is failing randomly
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Kyle M Hall
QA Contact: Jonathan Druart
URL:
Keywords:
Depends on: 20256
Blocks: 25551
  Show dependency treegraph
 
Reported: 2023-02-23 13:57 UTC by Jonathan Druart
Modified: 2023-12-28 20:43 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.04


Attachments
Bug 33054: Remove use of can_edit_items (11.26 KB, patch)
2023-02-23 14:25 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 33054: Fix unit tests (1.58 KB, patch)
2023-02-24 19:32 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2023-02-23 13:57:31 UTC
Koha_Master/2396

koha_1       |     #   Failed test 'The item is no longer present'
koha_1       |     #   at t/db_dependent/Koha/Acquisition/Order.t line 693.
koha_1       |     #          got: 'Koha::Item=HASH(0x5635919db9a8)'
koha_1       |     #     expected: undef
koha_1       | 
koha_1       |     #   Failed test 'No messages'
koha_1       |     #   at t/db_dependent/Koha/Acquisition/Order.t line 696.
koha_1       |     #          got: '1'
koha_1       |     #     expected: '0'
koha_1       | 
koha_1       |     #   Failed test 'The item is no longer present'
koha_1       |     #   at t/db_dependent/Koha/Acquisition/Order.t line 728.
koha_1       |     #          got: 'Koha::Item=HASH(0x563591a190f0)'
koha_1       |     #     expected: undef
koha_1       | 
koha_1       |     #   Failed test 'Cannot delete biblio and it gets notified'
koha_1       |     #   at t/db_dependent/Koha/Acquisition/Order.t line 732.
koha_1       |     #          got: 'error_delitem'
koha_1       |     #     expected: 'error_delbiblio_items'
koha_1       | 
koha_1       |     #   Failed test 'The item is no longer present'
koha_1       |     #   at t/db_dependent/Koha/Acquisition/Order.t line 776.
koha_1       |     #          got: 'Koha::Item=HASH(0x5635919db468)'
koha_1       |     #     expected: undef
koha_1       | 
koha_1       |     #   Failed test 'Cannot delete biblio and it gets notified'
koha_1       |     #   at t/db_dependent/Koha/Acquisition/Order.t line 779.
koha_1       |     #          got: 'error_delitem'
koha_1       |     #     expected: 'error_delbiblio_active_orders'
koha_1       | 
koha_1       |     #   Failed test 'The item is no longer present'
koha_1       |     #   at t/db_dependent/Koha/Acquisition/Order.t line 820.
koha_1       |     #          got: 'Koha::Item=HASH(0x563591a450a0)'
koha_1       |     #     expected: undef
koha_1       | 
koha_1       |     #   Failed test 'Cannot delete biblio and it gets notified'
koha_1       |     #   at t/db_dependent/Koha/Acquisition/Order.t line 823.
koha_1       |     #          got: 'error_delitem'
koha_1       |     #     expected: 'error_delbiblio_subscriptions'
koha_1       | 
koha_1       |     #   Failed test 'The item is not present'
koha_1       |     #   at t/db_dependent/Koha/Acquisition/Order.t line 853.
koha_1       |     #          got: 'Koha::Item=HASH(0x563591a16320)'
koha_1       |     #     expected: undef
koha_1       | 
koha_1       |     #   Failed test 'The biblio is not present'
koha_1       |     #   at t/db_dependent/Koha/Acquisition/Order.t line 854.
koha_1       |     #          got: 'Koha::Biblio=HASH(0x563591a69bd8)'
koha_1       |     #     expected: undef
koha_1       | 
koha_1       |     #   Failed test 'No errors'
koha_1       |     #   at t/db_dependent/Koha/Acquisition/Order.t line 856.
koha_1       |     #          got: '2'
koha_1       |     #     expected: '0'
koha_1       | 
koha_1       |     #   Failed test 'The item is no longer present'
koha_1       |     #   at t/db_dependent/Koha/Acquisition/Order.t line 905.
koha_1       |     #          got: 'Koha::Item=HASH(0x563591a7a1e8)'
koha_1       |     #     expected: undef
koha_1       | 
koha_1       |     #   Failed test 'Cannot delete on loan item'
koha_1       |     #   at t/db_dependent/Koha/Acquisition/Order.t line 910.
koha_1       |     #          got: '680'
koha_1       |     #     expected: '681'
koha_1       | 
koha_1       |     #   Failed test 'Item on loan notified'
koha_1       |     #   at t/db_dependent/Koha/Acquisition/Order.t line 911.
koha_1       |     #          got: 'not_same_branch'
koha_1       |     #     expected: 'book_on_loan'
koha_1       | 
koha_1       |     #   Failed test 'Cannot delete reserved and found item'
koha_1       |     #   at t/db_dependent/Koha/Acquisition/Order.t line 913.
koha_1       |     #          got: '681'
koha_1       |     #     expected: '682'
koha_1       | 
koha_1       |     #   Failed test 'Item reserved notified'
koha_1       |     #   at t/db_dependent/Koha/Acquisition/Order.t line 914.
koha_1       |     #          got: 'book_on_loan'
koha_1       |     #     expected: 'book_reserved'
koha_1       | 
koha_1       |     #   Failed test 'Cannot delete on loan item'
koha_1       |     #   at t/db_dependent/Koha/Acquisition/Order.t line 915.
koha_1       |     #          got: 'error_delitem'
koha_1       |     #     expected: 'error_delbiblio_items'
koha_1       |     # Looks like you planned 54 tests but ran 51.
koha_1       |     # Looks like you failed 17 tests of 51 run.
koha_1       | 
koha_1       | #   Failed test 'cancel() tests'
koha_1       | #   at t/db_dependent/Koha/Acquisition/Order.t line 940.
Comment 1 Kyle M Hall 2023-02-23 14:25:03 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2023-02-23 15:18:40 UTC
Did you understand why the failure was occurring randomly?
Comment 3 Tomás Cohen Arazi 2023-02-24 19:32:57 UTC
Created attachment 147396 [details] [review]
Bug 33054: Fix unit tests

This patch fixes the tests by making sure:
- The branch in userenv matches the home/holding branch so there are no
  circ rules getting in the middle
- Gives the user superlibrarian permissions for the same reasons above.

To test:
1. Run:
   $ ktd --shell
  k$ for i in $(seq 1 20 ); do prove t/db_dependent/Koha/Acquisition/Order.t ; done
=> FAIL: Notice it fails quite often. You can ctrl+c to interrupt once
it has failed at least once.
2. Apply this patch
3. Repeat 1
=> SUCCESS: it doesn't fail a single time
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 4 Tomás Cohen Arazi 2023-02-24 19:57:14 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 5 Matt Blenkinsop 2023-02-28 10:26:33 UTC
Nice work everyone!

Pushed to stable for 22.11.x
Comment 6 Lucas Gass 2023-03-08 13:21:32 UTC
Missing dependencies for 22.05.x, no backport.