Bugzilla – Attachment 78876 Details for
Bug 21355
GetDailyQuotes.t is fragile
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21355: Prevent GetDailyQuote.t to fail when run after 23:00
Bug-21355-Prevent-GetDailyQuotet-to-fail-when-run-.patch (text/plain), 2.49 KB, created by
Tomás Cohen Arazi (tcohen)
on 2018-09-15 19:04:55 UTC
(
hide
)
Description:
Bug 21355: Prevent GetDailyQuote.t to fail when run after 23:00
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2018-09-15 19:04:55 UTC
Size:
2.49 KB
patch
obsolete
>From 051bfa2de1a9b27debb348e708bc5f47eb99d70b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sat, 15 Sep 2018 11:24:32 -0700 >Subject: [PATCH] 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! >--- > t/db_dependent/Koha/GetDailyQuote.t | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Koha/GetDailyQuote.t b/t/db_dependent/Koha/GetDailyQuote.t >index dea55bc5d9..7bb48694bd 100644 >--- a/t/db_dependent/Koha/GetDailyQuote.t >+++ b/t/db_dependent/Koha/GetDailyQuote.t >@@ -61,7 +61,7 @@ $quote = GetDailyQuote('random'=>1); > ok($quote, "Got a random quote."); > cmp_ok($quote->{'id'}, '>', 0, 'Id is greater than 0'); > >-my $timestamp = DateTime::Format::MySQL->format_datetime(dt_from_string->add( hours => 1 )); # To make it the last one >+my $timestamp = DateTime::Format::MySQL->format_datetime(dt_from_string->add( seconds => 1 )); # To make it the last one > my $query = 'UPDATE quotes SET timestamp = ? WHERE id = ?'; > my $sth = C4::Context->dbh->prepare($query); > $sth->execute( $timestamp , $expected_quote->{'id'}); >@@ -70,7 +70,7 @@ $expected_quote->{'timestamp'} = $timestamp; > > $quote = GetDailyQuote(); # this is the "default" mode of selection > cmp_ok($quote->{'id'}, '==', $expected_quote->{'id'}, "Id is correct"); >-is($quote->{'quote'}, $expected_quote->{'quote'}, "Quote is correct"); >+is($quote->{'source'}, $expected_quote->{'source'}, "Source is correct"); > is($quote->{'timestamp'}, $expected_quote->{'timestamp'}, "Timestamp $timestamp is correct"); > > $dbh->do(q|DELETE FROM quotes|); >-- >2.19.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21355
:
78873
| 78876