Bug 38474

Summary: t/db_dependent/Letters.t can fail randomly
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: Test SuiteAssignee: Jonathan Druart <jonathan.druart>
Status: Pushed to main --- QA Contact: Katrin Fischer <katrin.fischer>
Severity: normal    
Priority: P5 - low CC: jonathan.druart
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
25.05.00
Circulation function:
Attachments: Bug 38474: Prevent Letters.t to fail on slow server

Description Katrin Fischer 2024-11-18 15:29:45 UTC
17:00:43 koha_1       | #   Failed test 'Time status changed equals time queued when created in message_queue table'
17:00:43 koha_1       | #   at t/db_dependent/Letters.t line 156.
17:00:43 koha_1       | #          got: '2024-11-15 16:00:00'
17:00:43 koha_1       | #     expected: '2024-11-15 15:59:59'
17:00:43 koha_1       | # Looks like you failed 1 test of 103.
17:00:43 koha_1       | [16:00:09] t/db_dependent/Letters.t .................................................... 

It looks like it took a little longer than expected maybe and the test fails because of it. If this is the issue, we could make it a little more robust.
Comment 1 Jonathan Druart 2024-11-18 15:33:47 UTC
It should use t::lib::Dates::compare
Comment 2 Jonathan Druart 2025-02-10 11:56:37 UTC
Again Koha_Main_U24/214

18:30:25 koha_1       | #   Failed test 'Time status changed equals time queued when created in message_queue table'
18:30:25 koha_1       | #   at t/db_dependent/Letters.t line 156.
18:30:25 koha_1       | #          got: '2025-02-05 17:27:07'
18:30:25 koha_1       | #     expected: '2025-02-05 17:27:06'
18:30:25 koha_1       | # Looks like you failed 1 test of 104.
18:30:25 koha_1       | [17:27:13] t/db_dependent/Letters.t
Comment 3 Jonathan Druart 2025-02-10 11:59:19 UTC
Created attachment 177676 [details] [review]
Bug 38474: Prevent Letters.t to fail on slow server

We must always use t::lib::Dates::compare when we compare dates in
tests.
Comment 4 Katrin Fischer 2025-02-13 14:32:33 UTC
Pushed for 25.05!

Well done everyone, thank you!