Bug 25540

Summary: Biblio.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: agustin.moyano, aleisha, andrewfh, martin.renvoize, tomascohen
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27062
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.05.00
Bug Depends on: 22284    
Bug Blocks: 25551    
Attachments: Bug 25540: Use build_sample_item
Bug 25540: DO NOT PUSH - diag statement
Bug 25540: Default for branches.pickup_location must be 0
Bug 25540: Use build_sample_item
Bug 25540: DO NOT PUSH - diag statement
Bug 25540: Default for branches.pickup_location must be 0
Bug 25540: Use build_sample_item
Bug 25540: Default for branches.pickup_location must be 0
Bug 25540: (follow-up) Test defined not true
Bug 22284: (QA follow-up) Fix test failures

Description Jonathan Druart 2020-05-19 10:27:09 UTC
Master_DO #874
11:37:04 koha_1       |     #   Failed test 'ReservesControlBranch: ItemHomeLibrary, biblio1, patron1 should return 6 but returns 7'
11:37:04 koha_1       |     #   at t/db_dependent/Koha/Biblio.t line 408.
11:37:04 koha_1       | 
11:37:04 koha_1       |     #   Failed test 'ReservesControlBranch: PatronLibrary, biblio1, patron1 should return 6 but returns 7'
11:37:04 koha_1       |     #   at t/db_dependent/Koha/Biblio.t line 408.
11:37:05 koha_1       |     # Looks like you planned 29 tests but ran 31.
11:37:05 koha_1       |     # Looks like you failed 2 tests of 31 run.
11:37:05 koha_1       | 
11:37:05 koha_1       | #   Failed test 'pickup_locations'
11:37:05 koha_1       | #   at t/db_dependent/Koha/Biblio.t line 435.
11:37:06 koha_1       | # Looks like you failed 1 test of 12.
11:37:06 koha_1       | [09:37:06] t/db_dependent/Koha/Biblio.t 

Was failing earlier on D10 as well.
Comment 1 Jonathan Druart 2020-05-19 13:32:33 UTC
Created attachment 105093 [details] [review]
Bug 25540: Use build_sample_item
Comment 2 Jonathan Druart 2020-05-19 13:32:37 UTC
Created attachment 105094 [details] [review]
Bug 25540: DO NOT PUSH - diag statement
Comment 3 Jonathan Druart 2020-05-19 13:34:08 UTC
I have no idea what's going in here. There is a library that is picked from... somewhere? See second patch.

Run the tests several times and it will fail at some point (before 30th run usually)
Comment 4 Jonathan Druart 2020-05-20 12:17:08 UTC
Again, Master_U18 #796
Comment 5 Jonathan Druart 2020-05-20 12:17:51 UTC
IMO This needs to be addressed for 20.05
Comment 6 Jonathan Druart 2020-05-22 13:05:30 UTC
Related test in t/db_dependent/Template/Plugin/Branches.t is failing as well:

14:31:13 koha_1       |         #   Failed test 'Libraries count is correct'
14:31:13 koha_1       |         #   at t/db_dependent/Template/Plugin/Branches.t line 176.
14:31:13 koha_1       |         #          got: '4'
14:31:13 koha_1       |         #     expected: '3'
14:31:13 koha_1       | 
14:31:13 koha_1       |         #   Failed test 'Libraries count is correct'
14:31:13 koha_1       |         #   at t/db_dependent/Template/Plugin/Branches.t line 184.
14:31:13 koha_1       |         #          got: '4'
14:31:13 koha_1       |         #     expected: '3'
14:31:13 koha_1       |         # Looks like you failed 2 tests of 4.
14:31:13 koha_1       | 
14:31:13 koha_1       |     #   Failed test 'selected tests'
14:31:13 koha_1       |     #   at t/db_dependent/Template/Plugin/Branches.t line 189.
14:31:13 koha_1       |     # Looks like you failed 1 test of 8.
14:31:13 koha_1       | 
14:31:13 koha_1       | #   Failed test 'pickup_locations() tests'
14:31:13 koha_1       | #   at t/db_dependent/Template/Plugin/Branches.t line 192.
Comment 7 Jonathan Druart 2020-05-22 13:34:21 UTC
Created attachment 105266 [details] [review]
Bug 25540: Default for branches.pickup_location must be 0

This is a try to fix failures in both
t/db_dependent/Template/Plugin/Branches.t
t/db_dependent/Koha/Biblio.t
Comment 8 Tomás Cohen Arazi 2020-05-22 22:39:58 UTC
Created attachment 105290 [details] [review]
Bug 25540: Use build_sample_item

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 9 Tomás Cohen Arazi 2020-05-22 22:40:03 UTC
Created attachment 105291 [details] [review]
Bug 25540: DO NOT PUSH - diag statement

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 10 Tomás Cohen Arazi 2020-05-22 22:40:08 UTC
Created attachment 105292 [details] [review]
Bug 25540: Default for branches.pickup_location must be 0

This is a try to fix failures in both
t/db_dependent/Template/Plugin/Branches.t
t/db_dependent/Koha/Biblio.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 11 Tomás Cohen Arazi 2020-05-22 22:50:27 UTC
Tha changes 'make sense'. But the Biblio.t tests explicitly delete all libraries and the added ones are totally controlled in terms of the pickup_location flag.

I certainly reproduced the failure in t/db_dependent/Template/Plugin/Branches.t with a loop calling the test 30 times, and couldn't reproduce it after applying the patches.
Comment 12 Martin Renvoize 2020-05-23 07:33:14 UTC
Thanks guys.. Passing QA on this one too, changes make sense and tests now pass consistently for me.
Comment 13 Martin Renvoize 2020-05-23 07:34:20 UTC
Created attachment 105296 [details] [review]
Bug 25540: Use build_sample_item

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 14 Martin Renvoize 2020-05-23 07:34:23 UTC
Created attachment 105297 [details] [review]
Bug 25540: Default for branches.pickup_location must be 0

This is a try to fix failures in both
t/db_dependent/Template/Plugin/Branches.t
t/db_dependent/Koha/Biblio.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 15 Martin Renvoize 2020-05-23 07:34:41 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 16 Aleisha Amohia 2020-06-12 01:46:29 UTC
tests not failing on 19.11.x so not backporting
Comment 19 Nick Clemens (kidclamp) 2021-01-15 14:12:31 UTC Comment hidden (obsolete)
Comment 20 Nick Clemens (kidclamp) 2021-01-15 14:13:41 UTC
Created attachment 115205 [details] [review]
Bug 22284: (QA follow-up) Fix test failures

Only libraries that are a pickup location will be returned as a pickup location

To test:
prove -v t/db_dependent/Koha/Biblio.t
it succeeds (maybe)
add a library that is not a pickup_location
prove the test
it fails
apply the patch
prove!
it passes!
Comment 21 Andrew Fuerste-Henry 2021-01-15 19:25:46 UTC
Follow up pushed to 20.05.x for 20.05.08