Bug 10666

Summary: Daily quotes tests are failing
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: Test SuiteAssignee: Fridolin Somers <fridolin.somers>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: bgkriegel, gmcharlt, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 10666 - Daily quotes tests are failing
Bug 10666 - Daily quotes tests are failing

Description Fridolin Somers 2013-07-31 09:39:22 UTC
In t/db_dependent/Koha.t, the test "Got a quote based on today's date" is failing :
$prove t/db_dependent/Koha.t :
t/db_dependent/Koha.t .. 1/6     
    #   Failed test 'Got a quote based on today's date.'
    #   at t/db_dependent/Koha.t line 126.
    # Compared $data->{"source"}
    #    got : 'Herbert Hoover'
    # expect : 'Abraham Lincoln'
    # Be sure to run this test on a clean install of sample data.
    # Looks like you failed 1 test of 4.

#   Failed test 'Daily Quotes Test'
#   at t/db_dependent/Koha.t line 129.

Looks like the wrong quote is returned by GetDailyQuote().
I'm using a databased created with the English sample SQL datas.

I think I found the cause :
The test "Got a random quote." calls GetDailyQuote('random'=>1) which changes the quote timestamp to now. When then testing GetDailyQuote(), this quote (which may not be the one created by test) is the most recent quote.
Comment 1 Fridolin Somers 2013-07-31 09:41:40 UTC Comment hidden (obsolete)
Comment 2 Kyle M Hall 2013-07-31 11:11:59 UTC
Created attachment 20001 [details] [review]
Bug 10666 - Daily quotes tests are failing

In t/db_dependent/Koha.t, the test "Got a quote based on today's date" is failing :
$prove t/db_dependent/Koha.t :
t/db_dependent/Koha.t .. 1/6
    #   Failed test 'Got a quote based on today's date.'
    #   at t/db_dependent/Koha.t line 126.
    # Compared $data->{"source"}
    #    got : 'Herbert Hoover'
    # expect : 'Abraham Lincoln'
    # Be sure to run this test on a clean install of sample data.
    # Looks like you failed 1 test of 4.

Looks like the wrong quote is returned by GetDailyQuote().
I'm using a databased created with the English sample SQL datas.

I think I found the cause :
The test "Got a random quote." calls GetDailyQuote('random'=>1) which changes the quote timestamp to now. When then testing GetDailyQuote(), this quote (which may not be the one created by test) is the most recent quote.

This patch moves the "Got a random quote." test after "Got a quote based on today's date" to solve the problem.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 3 Galen Charlton 2013-08-02 20:45:18 UTC
Works for me, and since it would be nice to make Jenkins happy (and hopefully no longer have it noisily report essentially false test suite failures), I've pushed this to master.  Fridolyn, thanks!
Comment 4 Galen Charlton 2013-08-16 00:38:49 UTC
Worked for me -- because my VM was set to UTC+0.  I've pushed a follow-up that improves the fix.
Comment 5 Tomás Cohen Arazi 2013-08-16 15:59:49 UTC
This patch has been pushed to 3.12.x, will be in 3.12.4.

Thanks Fridolyn!
Comment 6 Bernardo Gonzalez Kriegel 2013-09-13 22:53:26 UTC
Pushed to 3.10.x, will be in 3.10.11