Bug 24062

Summary: Circulation tests fail randomly if patron category type is 'X'
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Test SuiteAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: m.de.rooy, martin.renvoize, victor
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00, 19.05.12
Bug Depends on:    
Bug Blocks: 25551    
Attachments: Bug 24062: [DO NOT PUSH] Proof
Bug 24062: Fix the failing test
Bug 24062: Make sure TestBuilder will stop generate X or other invalid category's types
Bug 24062: [DO NOT PUSH] Proof
Bug 24062: Fix the failing test
Bug 24062: Make sure TestBuilder will stop generate X or other invalid category's types
Bug 24062: Fix the failing test
Bug 24062: Make sure TestBuilder will stop generate X or other invalid category's types

Description Jonathan Druart 2019-11-19 09:17:53 UTC
The items are not issued if the patron category's type is 'X', used for statistics.


koha_1       |     #   Failed test 'ISSUED_TO_ANOTHER question flag should be set if AutoReturnCheckedOutItems is disabled and item is checked out to another'
koha_1       |     #   at t/db_dependent/Circulation.t line 1994.
koha_1       |     #          got: undef
koha_1       |     #     expected: '1'
koha_1       |     # Looks like you planned 2 tests but ran 1.
koha_1       |     # Looks like you failed 1 test of 1 run.
koha_1       | 
koha_1       | #   Failed test 'CanBookBeIssued + AutoReturnCheckedOutItems'
koha_1       | #   at t/db_dependent/Circulation.t line 2001.
koha_1       | Can't call method "borrowernumber" on an undefined value at t/db_dependent/Circulation.t line 1998.
Comment 1 Jonathan Druart 2019-11-19 09:22:06 UTC
Created attachment 95524 [details] [review]
Bug 24062: [DO NOT PUSH] Proof

Only apply this patch and confirm the assumption is correct (test was
failing because X was generated for the patron category's type)
Comment 2 Jonathan Druart 2019-11-19 09:22:09 UTC
Created attachment 95525 [details] [review]
Bug 24062: Fix the failing test
Comment 3 Jonathan Druart 2019-11-19 09:22:13 UTC
Created attachment 95526 [details] [review]
Bug 24062: Make sure TestBuilder will stop generate X or other invalid category's types

To make sure this kind of random failures will not appear in a future we
are going to fix it at TestBuilder level.

Test plan:
  prove t/db_dependent/TestBuilder.t
and confirm it returns green

You could also only apply the tests against master, run them several
times and confirm that they fail most of the time.
Comment 4 Martin Renvoize 2019-11-19 11:17:46 UTC
Created attachment 95541 [details] [review]
Bug 24062: [DO NOT PUSH] Proof

Only apply this patch and confirm the assumption is correct (test was
failing because X was generated for the patron category's type)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize 2019-11-19 11:17:49 UTC
Created attachment 95542 [details] [review]
Bug 24062: Fix the failing test

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 6 Martin Renvoize 2019-11-19 11:17:52 UTC
Created attachment 95543 [details] [review]
Bug 24062: Make sure TestBuilder will stop generate X or other invalid category's types

To make sure this kind of random failures will not appear in a future we
are going to fix it at TestBuilder level.

Test plan:
  prove t/db_dependent/TestBuilder.t
and confirm it returns green

You could also only apply the tests against master, run them several
times and confirm that they fail most of the time.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Martin Renvoize 2019-11-19 11:18:21 UTC
Nice fix, works as expected.. thanks Jonathan.

Signed Off
Comment 8 Marcel de Rooy 2019-11-19 13:30:06 UTC
Looking here now
Comment 9 Marcel de Rooy 2019-11-19 13:46:18 UTC
Created attachment 95549 [details] [review]
Bug 24062: Fix the failing test

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 10 Marcel de Rooy 2019-11-19 13:46:23 UTC
Created attachment 95550 [details] [review]
Bug 24062: Make sure TestBuilder will stop generate X or other invalid category's types

To make sure this kind of random failures will not appear in a future we
are going to fix it at TestBuilder level.

Test plan:
  prove t/db_dependent/TestBuilder.t
and confirm it returns green

You could also only apply the tests against master, run them several
times and confirm that they fail most of the time.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 11 Marcel de Rooy 2019-11-19 13:47:32 UTC
Tric with the sub in gen_default has a slight hacky nature, but ok ;)
Comment 12 Jonathan Druart 2019-11-19 14:06:14 UTC
(In reply to Marcel de Rooy from comment #11)
> Tric with the sub in gen_default has a slight hacky nature, but ok ;)

I do not see it hacky but flexible however :) Any suggestions to improve it?
Comment 13 Martin Renvoize 2019-11-19 15:15:58 UTC
Nice work!

Pushed to master for 19.11.00
Comment 14 Victor Grousset/tuxayo 2020-06-11 16:11:09 UTC
Backported to 19.05.x branch for 19.05.12