| Summary: | Koha/Patrons.t: Subtests get_age and is_valid_age do not pass in another timezone | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Marcel de Rooy <m.de.rooy> |
| Component: | Test Suite | Assignee: | Marcel de Rooy <m.de.rooy> |
| Status: | CLOSED FIXED | QA Contact: | Katrin Fischer <katrin.fischer> |
| Severity: | minor | ||
| Priority: | P5 - low | CC: | fridolin.somers, jonathan.druart |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25621 | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | Trivial patch |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: | Version(s) released in: |
23.11.00,23.05.05,22.11.11
|
|
| Circulation function: | |||
| Attachments: |
Bug 34489: Testing
Bug 34489: Fix timezone problem in Patrons.t Bug 34489: Fix timezone problem in Patrons.t |
||
(In reply to Marcel de Rooy from comment #0) > Adding a tzset to UTC in the test as a workaround. Bug 25621 suggests > patching DateUtils.pm as a definitive solution? No tzset is not satisfactory. What about removing floating from get_age ? Created attachment 154318 [details] [review] Bug 34489: Testing dt_from_string is rather weird with time zones. Why not pass now in server_tz ? See testing patch too. Some tests in DateUtils.t are just wrong. Try testing in Pacific/Fiji. Having a difference of 13 hours, will make one of the rfc3339 tests fail. The test is wrong. This might be in the same category:
t/db_dependent/api/v1/patrons.t
not ok 6 - Filtering by date-time works
# Failed test 'Filtering by date-time works'
# at t/db_dependent/api/v1/patrons.t line 123.
# got: undef
# expected: '2253'
my $last_seen_rfc3339 = $last_seen . "z";
$t->get_ok("//$userid:$password@/api/v1/patrons?last_seen=" . $last_seen_rfc3339 . "&cardnumber=" . $patron->cardnumber)
>status_is(200)
>json_is( '/0/patron_id' => $patron->id, 'Filtering by date-time works' );
Comment on attachment 154318 [details] [review] Bug 34489: Testing Will be following same approach as on bug 34930 now. Created attachment 156285 [details] [review] Bug 34489: Fix timezone problem in Patrons.t See also bug 34930. Using same approach. Test plan: export TZ='Europe/Amsterdam' prove t/db_dependent/Koha/Patrons.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Trivial: Self SO Created attachment 156386 [details] [review] Bug 34489: Fix timezone problem in Patrons.t See also bug 34930. Using same approach. Test plan: export TZ='Europe/Amsterdam' prove t/db_dependent/Koha/Patrons.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Pushed to master for 23.11. Nice work everyone, thanks! Pushed to 23.05.x for 23.05.05 Nice work everyone! Pushed to oldstable for 22.11.x |
Running in Amsterdam TZ gives: # Subtest: get_age not ok 5 - Today=2020-02-28, dob=2004-02-28, should be 16 # Failed test 'Today=2020-02-28, dob=2004-02-28, should be 16' # at t/db_dependent/Koha/Patrons.t line 814. # got: '15' # expected: '16' not ok 9 - Today=2020-02-28, dob=2002-02-28, should be 18 not ok 16 - Today=2020-02-29, dob=2004-02-29, should be 16 not ok 19 - Today=2020-03-01, dob=2002-03-01, should be 18 not ok 23 - Today=2020-03-01, dob=2004-03-01, should be 16 not ok 25 - Today=2019-01-31, dob=2001-01-31, should be 18 not ok 28 - Today=2019-01-31, dob=2003-01-31, should be 16 # Looks like you failed 7 tests of 31. not ok 18 - get_age # Subtest: is_valid_age not ok 2 - Today=2020-02-28, dob=2009-02-28, is 11, should be valid=0 in category AGE_5_10 # Failed test 'Today=2020-02-28, dob=2009-02-28, is 11, should be valid=0 in category AGE_5_10' # at t/db_dependent/Koha/Patrons.t line 893. # got: '1' # expected: '0' not ok 7 - Today=2020-02-28, dob=2015-02-28, is 5, should be valid=1 in category AGE_5_10 # Failed test 'Today=2020-02-28, dob=2015-02-28, is 5, should be valid=1 in category AGE_5_10' # at t/db_dependent/Koha/Patrons.t line 893. # got: '0' # expected: '1' # Looks like you failed 2 tests of 10. not ok 19 - is_valid_age Adding a tzset to UTC in the test as a workaround. Bug 25621 suggests patching DateUtils.pm as a definitive solution?