Bugzilla – Attachment 23903 Details for
Bug 11470
Circulation_transfers.t can fail, spuriously
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11470: fix occassional spurious test failure in Circulation_transfers.t
Bug-11470-fix-occassional-spurious-test-failure-in.patch (text/plain), 2.71 KB, created by
Chris Cormack
on 2014-01-05 00:46:28 UTC
(
hide
)
Description:
Bug 11470: fix occassional spurious test failure in Circulation_transfers.t
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2014-01-05 00:46:28 UTC
Size:
2.71 KB
patch
obsolete
>From f9bfd03ea3a07c53c36620d984cd277d831e08e2 Mon Sep 17 00:00:00 2001 >From: Galen Charlton <gmc@esilibrary.com> >Date: Thu, 2 Jan 2014 18:02:17 +0000 >Subject: [PATCH] Bug 11470: fix occassional spurious test failure in > Circulation_transfers.t > >This patch makes Circulation_transfers.t no longer be sensitive to >the exact time it runs, avoiding spurious test failures due >to datesent being a second off between the creation of the test >transfer and the comparison. > >To test: > >[1] To simulate the failure, add a "sleep(2);" after the > "#Test GetTransfers" comment and run > prove -v t/db_dependent/Circulation_transfers.t >[2] Remove the sleep and apply the patch. >[3] Verify that prove -v t/db_dependent/Circulation_transfers.t passes. > >Signed-off-by: Galen Charlton <gmc@esilibrary.com> >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> >--- > t/db_dependent/Circulation_transfers.t | 14 ++++++-------- > 1 file changed, 6 insertions(+), 8 deletions(-) > >diff --git a/t/db_dependent/Circulation_transfers.t b/t/db_dependent/Circulation_transfers.t >index 5328bde..25e720a 100644 >--- a/t/db_dependent/Circulation_transfers.t >+++ b/t/db_dependent/Circulation_transfers.t >@@ -10,6 +10,7 @@ use Koha::DateUtils; > use DateTime::Duration; > > use Test::More tests => 19; >+use Test::Deep; > > BEGIN { > use_ok('C4::Circulation'); >@@ -140,13 +141,10 @@ is(CreateBranchTransferLimit(undef,$samplebranch2->{branchcode}),undef, > #is(CreateBranchTransferLimit(-1,-1,'CODE'),0,"With wrong CreateBranchTransferLimit returns 0 - No transfertlimit added"); > > #Test GetTransfers >-my $dt_today = dt_from_string( undef, 'sql', undef ); >-my $today = $dt_today->strftime("%Y-%m-%d %H:%M:%S"); >- > my @transfers = GetTransfers($item_id1); >-is_deeply( >+cmp_deeply( > \@transfers, >- [ $today, $samplebranch1->{branchcode}, $samplebranch2->{branchcode} ], >+ [ re('^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$'), $samplebranch1->{branchcode}, $samplebranch2->{branchcode} ], > "Transfers of the item1" > ); #NOTE: Only the first transfer is returned > @transfers = GetTransfers; >@@ -159,17 +157,17 @@ is_deeply( \@transfers, [], > #Test GetTransfersFromTo > my @transferfrom1to2 = GetTransfersFromTo( $samplebranch1->{branchcode}, > $samplebranch2->{branchcode} ); >-is_deeply( >+cmp_deeply( > \@transferfrom1to2, > [ > { > itemnumber => $item_id1, >- datesent => $today, >+ datesent => re('^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$'), > frombranch => $samplebranch1->{branchcode} > }, > { > itemnumber => $item_id2, >- datesent => $today, >+ datesent => re('^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$'), > frombranch => $samplebranch1->{branchcode} > } > ], >-- >1.8.5.2
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 11470
:
23895
|
23903
|
23908
|
23909