Bug 25729 - Charges/Fees.t is failing on slow servers due to wrong date comparison
Summary: Charges/Fees.t is failing on slow servers due to wrong date comparison
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 25551
  Show dependency treegraph
 
Reported: 2020-06-12 16:31 UTC by Victor Grousset/tuxayo
Modified: 2021-06-14 21:31 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.03, 19.11.09, 19.05.15


Attachments
Bug 25729: Prevent Charges/Fees.t to fail on slow server (1.07 KB, patch)
2020-07-27 13:16 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 Victor Grousset/tuxayo 2020-06-12 16:31:55 UTC
Independent from bug 24417

I was able to get this failure locally after 3100 runs with koha-testing-docker with KOHA_IMAGE=19.05-stretch.

It was on 19.05.x but it's expected to happen in master.

t/db_dependent/Koha/Charges/Fees.t .. 1/8 
    #   Failed test 'from_date default set correctly to today'
    #   at t/db_dependent/Koha/Charges/Fees.t line 199.
    #          got: '2020-06-12T05:05:16'
    #     expected: '2020-06-12T05:05:17'
    # Looks like you failed 1 test of 9.
t/db_dependent/Koha/Charges/Fees.t .. 2/8 
#   Failed test 'new'
#   at t/db_dependent/Koha/Charges/Fees.t line 201.
# Looks like you failed 1 test of 8.
t/db_dependent/Koha/Charges/Fees.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/8 subtests


After 2813 runs, same environment.
t/db_dependent/Koha/Charges/Fees.t .. 1/8 
    #   Failed test 'from_date default set correctly to today'
    #   at t/db_dependent/Koha/Charges/Fees.t line 199.
    #          got: '2020-06-12T14:25:18'
    #     expected: '2020-06-12T14:25:19'
    # Looks like you failed 1 test of 9.
t/db_dependent/Koha/Charges/Fees.t .. 2/8 
#   Failed test 'new'
#   at t/db_dependent/Koha/Charges/Fees.t line 201.
# Looks like you failed 1 test of 8.
Comment 1 Victor Grousset/tuxayo 2020-06-12 16:42:57 UTC
Jonathan Druart:
> 201     is( $fees->from_date, dt_from_string(),
> 202         'from_date default set correctly to today' );
> 
> It can be fixed using t::lib::Dates::compare

[...]

> it's the comparaison of 2 datetimes that have not been init at the same time
we assume there are both init in the same second, but that's wrong
the method in t::lib::Dates deals with that comparaison correctly
Comment 2 Victor Grousset/tuxayo 2020-06-12 17:04:15 UTC
Confirmed on master!
After 1322 runs:

t/db_dependent/Koha/Charges/Fees.t .. 2/8 
    #   Failed test 'from_date default set correctly to today'
    #   at t/db_dependent/Koha/Charges/Fees.t line 201.
    #          got: '2020-06-12T16:49:33'
    #     expected: '2020-06-12T16:49:34'
    # Looks like you failed 1 test of 9.

#   Failed test 'new'
#   at t/db_dependent/Koha/Charges/Fees.t line 203.
Comment 3 Jonathan Druart 2020-07-27 13:16:58 UTC
Created attachment 107416 [details] [review]
Bug 25729: Prevent Charges/Fees.t to fail on slow server

We must use t::lib::Dates::compare to compare dates

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 4 Jonathan Druart 2020-07-27 15:26:03 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 5 Victor Grousset/tuxayo 2020-07-27 18:15:54 UTC
Thanks a lot Jonathan!
Comment 6 Lucas Gass 2020-07-31 20:36:47 UTC
backported to 20.05.x for 20.05.03
Comment 7 Aleisha Amohia 2020-08-03 23:44:23 UTC
backported to 19.11.x for 19.11.09
Comment 8 Victor Grousset/tuxayo 2020-09-18 20:24:49 UTC
Backported to 19.05.x branch for 19.05.15