Bug 15029

Summary: Tests fail if launched after 23:00
Product: Koha Reporter: Jonathan Druart <jonathan.druart+koha>
Component: Test SuiteAssignee: Jonathan Druart <jonathan.druart+koha>
Status: CLOSED FIXED QA Contact: Galen Charlton <gmcharlt>
Severity: major    
Priority: P5 - low CC: chris, katrin.fischer, liz, tomascohen
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18009
Change sponsored?: --- Patch complexity: ---
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 18009, 21360    
Attachments: Bug 15029: Make the IssueSlip tests pass even if launched after 23:00
Bug 15029: Make the IssueSlip tests pass even if launched after 23:00
[PASSED QA] Bug 15029: Make the IssueSlip tests pass even if launched after 23:00

Description Jonathan Druart 2015-10-19 15:17:24 UTC
% sudo date -s "2015-10-19 23:50:00";prove t/db_dependent/Members/IssueSlip.t
Mon 19 Oct 23:50:00 BST 2015
t/db_dependent/Members/IssueSlip.t ..         # Child (Hourly loans) exited without calling finalize()
    
    #   Failed test 'Hourly loans'
    #   at /home/koha/perl5/lib/perl5/Test/Builder.pm line 276.
The 'hour' parameter ("24") to DateTime::set did not pass the 'an integer between 0 and 23' callback
 at /usr/lib/i386-linux-gnu/perl5/5.20/DateTime.pm line 1944.
        DateTime::set(undef, "hour", 24) called at t/db_dependent/Members/IssueSlip.t line 200
        main::__ANON__() called at /home/koha/perl5/lib/perl5/Test/Builder.pm line 258
        Test::Builder::__ANON__() called at /home/koha/perl5/lib/perl5/Test/Builder.pm line 263
        eval {...} called at /home/koha/perl5/lib/perl5/Test/Builder.pm line 263
        Test::Builder::subtest(Test::Builder=HASH(0x9dd4818), "Hourly loans", CODE(0xd30bc20)) called at /home/koha/perl5/lib/perl5/Test/More.pm line 770
        Test::More::subtest("Hourly loans", CODE(0xd30bc20)) called at t/db_dependent/Members/IssueSlip.t line 259
        main::__ANON__() called at /home/koha/perl5/lib/perl5/Test/Builder.pm line 258
        Test::Builder::__ANON__() called at /home/koha/perl5/lib/perl5/Test/Builder.pm line 263
        eval {...} called at /home/koha/perl5/lib/perl5/Test/Builder.pm line 263
        Test::Builder::subtest(Test::Builder=HASH(0x9dd4818), "Issue slip", CODE(0xd13eb1c)) called at /home/koha/perl5/lib/perl5/Test/More.pm line 770
        Test::More::subtest("Issue slip", CODE(0xd13eb1c)) called at t/db_dependent/Members/IssueSlip.t line 261
    # Child (Issue slip) exited without calling finalize()
t/db_dependent/Members/IssueSlip.t .. 1/3 
#   Failed test 'Issue slip'
#   at /home/koha/perl5/lib/perl5/Test/Builder.pm line 276.
# Looks like you planned 3 tests but ran 1.
# Looks like you failed 1 test of 1 run.
# Looks like your test exited with 29 just after 1.
t/db_dependent/Members/IssueSlip.t .. Dubious, test returned 29 (wstat 7424, 0x1d00)
Failed 3/3 subtests 

Test Summary Report
-------------------
t/db_dependent/Members/IssueSlip.t (Wstat: 7424 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 29
  Parse errors: Bad plan.  You planned 3 tests but ran 1.
Files=1, Tests=1,  2 wallclock secs ( 0.02 usr  0.00 sys +  1.60 cusr  0.04 csys =  1.66 CPU)
Result: FAIL
Comment 1 Jonathan Druart 2015-10-19 15:19:39 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2015-10-19 15:20:35 UTC
Ccing RM & RMaints
Comment 3 Tomás Cohen Arazi 2015-10-20 14:10:40 UTC Comment hidden (obsolete)
Comment 4 Kyle M Hall 2015-10-20 17:20:47 UTC
Created attachment 43660 [details] [review]
[PASSED QA] Bug 15029: Make the IssueSlip tests pass even if launched after 23:00

Prior to this patch, the tests did not pass if they were launched after
23:00.
DateTime complains if you ask for creating a date with hour => 24 (which
is logical so far).

Test plan:
0/ Don't apply this patch
1/ sudo date -s "2015-10-19 23:50:00";prove
t/db_dependent/Members/IssueSlip.t
2/ Apply this patch and repeat 1.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Tomás Cohen Arazi 2015-10-20 18:26:46 UTC
Patch pushed to master.

Thanks Jonathan!
Comment 6 Chris Cormack 2015-10-24 08:29:21 UTC
Pushed to 3.20.x will be in 3.20.5