Bug 21355 - GetDailyQuotes.t is fragile
Summary: GetDailyQuotes.t is fragile
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: Tomás Cohen Arazi
URL:
Keywords:
Depends on: 20144
Blocks:
  Show dependency treegraph
 
Reported: 2018-09-15 18:26 UTC by Tomás Cohen Arazi
Modified: 2019-10-14 19:58 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:


Attachments
Bug 21355: Prevent GetDailyQuote.t to fail when run after 23:00 (2.19 KB, patch)
2018-09-15 18:28 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21355: Prevent GetDailyQuote.t to fail when run after 23:00 (2.49 KB, patch)
2018-09-15 19:04 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2018-09-15 18:26:06 UTC
Problems found:
- the arithmetic adds an hour to some dates, so if it is run close to midnight, the daily quote will fail
- 'quote' attribute is compared, and it doesn't exist. Should be 'text'.
Comment 1 Jonathan Druart 2018-09-15 18:28:01 UTC
Created attachment 78873 [details] [review]
Bug 21355: Prevent GetDailyQuote.t to fail when run after 23:00

Tests will fail (Jenkins run #554) if run after 23:00

 #   Failed test 'Id is correct'
 #   at t/db_dependent/Koha/GetDailyQuote.t line 72.
 #          got: 6
 #     expected: 8

 #   Failed test 'Timestamp 2018-09-15 00:44:46 is correct'
 #   at t/db_dependent/Koha/GetDailyQuote.t line 74.
 #          got: '2018-09-14 23:44:46'
 #     expected: '2018-09-15 00:44:46'
 # Looks like you failed 2 tests of 12.
 [23:44:46] t/db_dependent/Koha/GetDailyQuote.t
 Dubious, test returned 2 (wstat 512, 0x200)

Adding only 1 second will hugely reduce the risk of failure here.

It also updates a useless test (column 'quote' does not exist)
Comment 2 Tomás Cohen Arazi 2018-09-15 19:04:55 UTC
Created attachment 78876 [details] [review]
Bug 21355: Prevent GetDailyQuote.t to fail when run after 23:00

Tests will fail (Jenkins run #554) if run after 23:00

 #   Failed test 'Id is correct'
 #   at t/db_dependent/Koha/GetDailyQuote.t line 72.
 #          got: 6
 #     expected: 8

 #   Failed test 'Timestamp 2018-09-15 00:44:46 is correct'
 #   at t/db_dependent/Koha/GetDailyQuote.t line 74.
 #          got: '2018-09-14 23:44:46'
 #     expected: '2018-09-15 00:44:46'
 # Looks like you failed 2 tests of 12.
 [23:44:46] t/db_dependent/Koha/GetDailyQuote.t
 Dubious, test returned 2 (wstat 512, 0x200)

Adding only 1 second will hugely reduce the risk of failure here.

It also updates a useless test (column 'quote' does not exist)

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

Tested:
- Run:
  $ sudo date -s 2018-09-15T23:10:00
  $ kshell
 k$ prove t/db_dependent/Koha/GetDailyQuote.t
=> FAIL: Tests fail as patch author mentions
- Apply the patch
 k$ prove t/db_dependent/Koha/GetDailyQuote.t
=> SUCCESS: Tests pass!
Comment 3 Tomás Cohen Arazi 2018-09-15 20:20:58 UTC
:_D
Comment 4 Nick Clemens 2018-09-15 23:29:21 UTC
Awesome work all!

Pushed to master for 18.11
Comment 5 Martin Renvoize 2018-09-17 13:53:39 UTC
Pushed to 18.05.x for 18.05.04
Comment 6 Fridolin Somers 2018-09-24 09:49:59 UTC
Depends on Bug 20144 not in 17.11.x