Bug 19403

Summary: Again and again, Circulation.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: fridolin.somers, katrin.fischer
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19455
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 19009    
Bug Blocks: 25551, 19776, 20721    
Attachments: Bug 19403: Add some default values when building patrons for test
Bug 19403: Prevent Circulation.t to fail randomly

Description Jonathan Druart 2017-10-03 17:11:49 UTC
#   Failed test 'No error or alert should be raised'
    #   at t/db_dependent/Circulation.t line 1553.
    #          got: '1'
    #     expected: '0'

    #   Failed test 'BIBLIO_ALREADY_ISSUED question flag should be set if AllowMultipleIssuesOnABiblio=0 and issue already exists'
    #   at t/db_dependent/Circulation.t line 1554.
    #          got: undef
    #     expected: '1'

    #   Failed test 'No BIBLIO_ALREADY_ISSUED flag should be set if AllowMultipleIssuesOnABiblio=1'
    #   at t/db_dependent/Circulation.t line 1558.
    #          got: '1'
    #     expected: '0'

    #   Failed test 'No BIBLIO_ALREADY_ISSUED flag should be set if it is a subscription'
    #   at t/db_dependent/Circulation.t line 1565.
    #          got: '1'
    #     expected: '0'

    #   Failed test 'No BIBLIO_ALREADY_ISSUED flag should be set if it is a subscription'
    #   at t/db_dependent/Circulation.t line 1569.
    #          got: '1'
    #     expected: '0'
    # Looks like you failed 5 tests of 5.

#   Failed test 'CanBookBeIssued + AllowMultipleIssuesOnABiblio'
#   at t/db_dependent/Circulation.t line 1570.
# Looks like you failed 1 test of 102.
[15:00:27] t/db_dependent/Circulation.t ...................................
Comment 1 Jonathan Druart 2017-10-03 17:36:32 UTC
Created attachment 67565 [details] [review]
Bug 19403: Add some default values when building patrons for test

To avoid some tests to fail randomly

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 2 Jonathan Druart 2017-10-03 17:36:37 UTC
Created attachment 67566 [details] [review]
Bug 19403: Prevent Circulation.t to fail randomly

Due to the number of test cases handle by CanBookBeIssued, Circulation.t
fails randomly. To prevent that it is better to set some values.
For instance if the patron is a statistical patron (category_type=X),
the subroutine will return a STATS flag.

This patch also adds a subroutine to the test file to display the keys
of $error, $question and $alert set by CanBookBeIssued.
It will be easier to track other random failures.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 3 Jonathan Druart 2017-10-03 17:37:33 UTC
Pushed to master for 17.11.
Comment 4 Fridolin Somers 2017-10-27 13:07:29 UTC
Pushed to 17.05.x, will be in 17.05.06.
Comment 5 Katrin Fischer 2017-10-29 18:44:31 UTC
Depends on a bug that is not in 16.11.x (didn't apply). Please fix dependencies if you want this to be included.