Bug 18009 - IssueSlip.t test fails if launched between 00:00 and 00:59
Summary: IssueSlip.t test fails if launched between 00:00 and 00:59
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Mason James
QA Contact: Galen Charlton
URL:
Whiteboard:
Keywords:
Depends on: 15029
Blocks:
  Show dependency treegraph
 
Reported: 2017-01-29 01:54 UTC by Mason James
Modified: 2017-06-14 22:17 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 18009 - IssueSlip.t test fails if launched between 00:00 and 00:59 (2.19 KB, patch)
2017-01-29 10:58 UTC, Mason James
Details | Diff | Splinter Review
Bug 18009 - IssueSlip.t test fails if launched between 00:00 and 00:59 (2.26 KB, patch)
2017-01-31 18:12 UTC, M. Tompsett
Details | Diff | Splinter Review
Bug 18009 - IssueSlip.t test fails if launched between 00:00 and 00:59 (2.32 KB, patch)
2017-02-01 09:40 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Mason James 2017-01-29 01:54:53 UTC
here's an example of the test passing then failing with 2 different dates.


-------------------------
vagrant@kohadevbox:~$ sudo date -s 'Sun Jan 29 01:41:55 UTC 2017'
Sun Jan 29 01:41:55 GMT 2017
kohadev-koha@kohadevbox:/home/vagrant/kohaclone$ prove t/db_dependent/Members/IssueSlip.t
t/db_dependent/Members/IssueSlip.t .. ok
All tests successful.
Files=1, Tests=3,  3 wallclock secs ( 0.03 usr  0.00 sys +  2.10 cusr  0.12 csys =  2.25 CPU)
Result: PASS

-------------------------
vagrant@kohadevbox:~$ sudo date -s 'Sun Jan 29 00:41:55 UTC 2017'
Sun Jan 29 00:41:55 GMT 2017
kohadev-koha@kohadevbox:/home/vagrant/kohaclone$ prove t/db_dependent/Members/IssueSlip.t
t/db_dependent/Members/IssueSlip.t ..         # Looks like you planned 2 tests but ran 1.

    #   Failed test 'Hourly loans'
    #   at t/db_dependent/Members/IssueSlip.t line 279.
    # Looks like you failed 1 test of 3.
t/db_dependent/Members/IssueSlip.t .. 1/3
#   Failed test 'Issue slip'
#   at t/db_dependent/Members/IssueSlip.t line 281.
The 'hour' parameter ("-1") to DateTime::set did not pass the 'an integer between 0 and 23' callback
 at /usr/lib/x86_64-linux-gnu/perl5/5.20/DateTime.pm line 1946.
        DateTime::set(undef, "hour", -1) called at t/db_dependent/Members/IssueSlip.t line 254
        main::__ANON__() called at /usr/local/share/perl/5.20.2/Test/Builder.pm line 309
        eval {...} called at /usr/local/share/perl/5.20.2/Test/Builder.pm line 309
        Test::Builder::subtest(Test::Builder=HASH(0x1cfa9d0), "Hourly loans", CODE(0x85c7ea0)) called at /usr/local/share/perl/5.20.2/Test/More.pm line 807
        Test::More::subtest("Hourly loans", CODE(0x85c7ea0)) called at t/db_dependent/Members/IssueSlip.t line 279
        main::__ANON__() called at /usr/local/share/perl/5.20.2/Test/Builder.pm line 309
        eval {...} called at /usr/local/share/perl/5.20.2/Test/Builder.pm line 309
        Test::Builder::subtest(Test::Builder=HASH(0x1cfa9d0), "Issue slip", CODE(0x86031c8)) called at /usr/local/share/perl/5.20.2/Test/More.pm line 807
        Test::More::subtest("Issue slip", CODE(0x86031c8)) called at t/db_dependent/Members/IssueSlip.t line 281
# Looks like your test exited with 255 just after 1.
t/db_dependent/Members/IssueSlip.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 3/3 subtests

Test Summary Report
-------------------
t/db_dependent/Members/IssueSlip.t (Wstat: 65280 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 255
  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.79 cusr  0.08 csys =  1.89 CPU)
Result: FAIL
-------------------------
Comment 1 Mason James 2017-01-29 10:58:50 UTC
Created attachment 59629 [details] [review]
Bug 18009 - IssueSlip.t test fails if launched between 00:00 and 00:59

to test patch...

1/ set date between 00:00 and 00:59
$ sudo date -s 'Sun Jan 29 00:41:55 NZDT 2017'

2/ run prove, see fail
$ prove -v t/db_dependent/Members/IssueSlip.t
...
t/db_dependent/Members/IssueSlip.t (Wstat: 65280 Tests: 1 Failed: 0)
Result: FAIL

3/ apply patch

4/ run prove, see pass
$ prove -v t/db_dependent/Members/IssueSlip.t
...
All tests successful.
Result: PASS
Comment 2 M. Tompsett 2017-01-31 18:12:19 UTC
Created attachment 59695 [details] [review]
Bug 18009 - IssueSlip.t test fails if launched between 00:00 and 00:59

to test patch...

1/ set date between 00:00 and 00:59
$ sudo date -s 'Sun Jan 29 00:41:55 NZDT 2017'

2/ run prove, see fail
$ prove -v t/db_dependent/Members/IssueSlip.t
...
t/db_dependent/Members/IssueSlip.t (Wstat: 65280 Tests: 1 Failed: 0)
Result: FAIL

3/ apply patch

4/ run prove, see pass
$ prove -v t/db_dependent/Members/IssueSlip.t
...
All tests successful.
Result: PASS

NOTE: for code obscurity you could have also done a modulus 24. ;)

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 3 Jonathan Druart 2017-02-01 09:40:13 UTC
Created attachment 59727 [details] [review]
Bug 18009 - IssueSlip.t test fails if launched between 00:00 and 00:59

to test patch...

1/ set date between 00:00 and 00:59
$ sudo date -s 'Sun Jan 29 00:41:55 NZDT 2017'

2/ run prove, see fail
$ prove -v t/db_dependent/Members/IssueSlip.t
...
t/db_dependent/Members/IssueSlip.t (Wstat: 65280 Tests: 1 Failed: 0)
Result: FAIL

3/ apply patch

4/ run prove, see pass
$ prove -v t/db_dependent/Members/IssueSlip.t
...
All tests successful.
Result: PASS

NOTE: for code obscurity you could have also done a modulus 24. ;)

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 4 Kyle M Hall 2017-02-14 13:59:26 UTC
Pushed to master for 17.05, thanks Mason!
Comment 5 Katrin Fischer 2017-02-14 19:56:02 UTC
This patch has been pushed to 16.11.x and will be in 16.11.04.
Comment 6 Julian Maurice 2017-02-20 09:31:34 UTC
Pushed to 3.22.x for 3.22.17