DST bugs in perl live tests

Bug #1386260 reported by Jason Etheridge
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Undecided
Unassigned

Bug Description

At certain times of the year, apparently around a change in daylight savings time, certain date-based perl tests will fail. Some of these tests are doing date math to set up relative dates. I'm not sure if the bug is there or actually in Evergreen, but I suspect it's within the tests themselves.

Here's an example of a test run that failed:
http://testing.evergreen-ils.org/~live/archive/2014-10/2014-10-27_04:00:01/

And, in particular, the output from the perl live tests:

Sun Oct 26 16:26:59 EDT 2014
perl Build.PL --destdir || make -s build-perl-fail
Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'OpenILS' version '2.4'
./Build test --test_files live_t || make -s build-perl-fail
# Simple tests against the open-ils.storage service and the stock test data.
Subroutine section_pkg redefined at (eval 1519) line 4.
live_t/00-simple.t ..................... ok
# Simple tests against the open-ils.auth service, memcached, and the stock test data.
Subroutine section_pkg redefined at (eval 1519) line 4.
live_t/01-auth.t ....................... ok
# Test circulation of item CONC70000345 against the admin user.
Subroutine section_pkg redefined at (eval 1519) line 4.
live_t/02-simple_circ.t ................ ok
# Test fine generation on checkin against the admin user.
Subroutine section_pkg redefined at (eval 1519) line 4.

# Failed test 'Thirteen bills associated with circulation'
# at live_t/03-overdue_circ.t line 203.
# got: '12'
# expected: '13'
# Looks like you failed 1 test of 20.
live_t/03-overdue_circ.t ...............
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/20 subtests
# Test fine generation with closed date on checkin against the admin user.
Subroutine section_pkg redefined at (eval 1519) line 4.

# Failed test 'Twelve bills associated with circulation (instead of 13, thanks to closed date)'
# at live_t/04-overdue_with_closed_dates.t line 260.
# got: '11'
# expected: '12'
# Looks like you failed 1 test of 23.
live_t/04-overdue_with_closed_dates.t ..
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/23 subtests
# Test bill payment against the admin user.
Subroutine section_pkg redefined at (eval 1519) line 4.

# Failed test 'Both transactions combined have a balance owed of 1.25'
# at live_t/05-pay_bills.t line 103.
# got: '1.15'
# expected: '1.25'
# Looks like you failed 1 test of 10.
live_t/05-pay_bills.t ..................
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/10 subtests
# Fetches and updates a bib records MARC data
Subroutine section_pkg redefined at (eval 1523) line 4.
live_t/06-bib_rec_fetch_update.t ....... ok
# Tests Anonymous PCRUD personality for CStoreEditor
Subroutine section_pkg redefined at (eval 1519) line 4.
live_t/07-anon_pcrud.t ................. ok

Test Summary Report
-------------------
live_t/03-overdue_circ.t (Wstat: 256 Tests: 20 Failed: 1)
  Failed test: 20
  Non-zero exit status: 1
live_t/04-overdue_with_closed_dates.t (Wstat: 256 Tests: 23 Failed: 1)
  Failed test: 22
  Non-zero exit status: 1
live_t/05-pay_bills.t (Wstat: 256 Tests: 10 Failed: 1)
  Failed test: 7
  Non-zero exit status: 1
Files=8, Tests=84, 17 wallclock secs ( 0.06 usr 0.05 sys + 6.81 cusr 0.63 csys = 7.55 CPU)
Result: FAIL
Failed 3/8 test programs. 3/84 subtests failed.

>>> Build/test of Perl modules has failed. The most likely
>>> possibility is that a dependency is not pre-installed
>>> or that a test has failed.
>>> See the messages above this one for more information.

Return Value = 2

Tags: pullrequest
Revision history for this message
Jason Etheridge (phasefx) wrote :

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/collab/phasefx/fix_date_math

commit bcca9cda6c299c89c22e88ff26c3527c62d489d7
Author: Jason Etheridge <email address hidden>
Date: Fri Nov 7 13:00:10 2014 -0500

    lp1386260 DST bugs in perl live tests

    Use safer date math to handle bug with DST

    Signed-off-by: Jason Etheridge <email address hidden>

diff --git a/Open-ILS/src/perlmods/live_t/03-overdue_circ.t b/Open-ILS/src/perlmods/live_t/03-overdue_circ.t
index 7981d32..fd83b2c 100644
--- a/Open-ILS/src/perlmods/live_t/03-overdue_circ.t
+++ b/Open-ILS/src/perlmods/live_t/03-overdue_circ.t
@@ -145,13 +145,12 @@ if (my $bill_resp = $bill_req->recv) {
     }
 }

-my $xact_start = DateTime::Format::ISO8601->parse_datetime(cleanse_ISO8601($circ->xact_start))->epoch;
-my $due_date = DateTime::Format::ISO8601->parse_datetime(cleanse_ISO8601($circ->due_date))->epoch;
-my $twenty_days = OpenSRF::Utils->interval_to_seconds('480 h 0 m 0 s');
+my $xact_start = DateTime::Format::ISO8601->parse_datetime(cleanse_ISO8601($circ->xact_start));
+my $due_date = DateTime::Format::ISO8601->parse_datetime(cleanse_ISO8601($circ->due_date));

 # Rewrite history; technically we should rewrite status_changed_item on the copy as well, but, meh...
-$circ->xact_start( $apputils->epoch2ISO8601($xact_start - $twenty_days) );
-$circ->due_date( $apputils->epoch2ISO8601($due_date - $twenty_days) );
+$circ->xact_start( $xact_start->subtract( days => 20 )->iso8601() );
+$circ->due_date( $due_date->subtract( days => 20 )->iso8601() );

 $cstore_ses->connect; # need stateful connection
 my $xact = $cstore_ses->request('open-ils.cstore.transaction.begin')->gather(1);

Changed in evergreen:
assignee: nobody → Jason Etheridge (phasefx)
tags: added: pullrequest
Changed in evergreen:
status: New → In Progress
Revision history for this message
Jason Etheridge (phasefx) wrote :

live_t/ tests assume a running Evergreen with the stock test data, created with eg_db_config using parameters --load-all-sample and --admin-user admin and --admin-pass demo123

Testing this script would look something like this:

opensrf@dev141:~/git/Evergreen/Open-ILS/src/perlmods (fix_date_math)$ perl live_t/03-overdue_circ.t
1..20
# Test fine generation on checkin against the admin user.
ok 1 - open-ils.storage.direct.actor.user.retrieve returned aou object
ok 2 - User with id = 1 is admin user
ok 3 - open-ils.storage.direct.asset.copy.retrieve returned acp object
ok 4 - Item with id = 810 has barcode CONC71000345
ok 5 - Item with id = 810 has status of Reshelving or Available
ok 6 - Have an authtoken
ok 7 - Registered a new workstation
ok 8 - Have an authtoken associated with the workstation
ok 9 - Checkout request returned a HASH
ok 10 - Checkout returned a SUCCESS event
ok 11 - Checkout response object has payload object
ok 12 - Payload object has circ object
ok 13 - Circ objection has loan duration of "7 days"
ok 14 - Item with id = 810 has status of Checked Out after fresh Storage request
ok 15 - Zero bills associated with circulation
ok 16 - rewrote circ to have happened 20 days ago
ok 17 - Checkin request returned a HASH
ok 18 - Checkin returned a SUCCESS event
ok 19 - Item with id = 810 has status of Reshelving or Available after fresh Storage request
ok 20 - Thirteen bills associated with circulation

tags: removed: pullrequest
Revision history for this message
Jason Etheridge (phasefx) wrote :

pushed another commit fixing live_t/04-overdue_with_closed_dates.t

opensrf@dev141:~/git/Evergreen/Open-ILS/src/perlmods (fix_date_math)$ perl live_t/04-overdue_with_closed_dates.t
1..23
# Test fine generation with closed date on checkin against the admin user.
ok 1 - open-ils.storage.direct.actor.user.retrieve returned aou object
ok 2 - User with id = 1 is admin user
ok 3 - open-ils.storage.direct.asset.copy.retrieve returned acp object
ok 4 - Item with id = 1310 has barcode CONC72000345
ok 5 - Item with id = 1310 has status of Reshelving or Available
ok 6 - Have an authtoken
ok 7 - Registered a new workstation
ok 8 - Have an authtoken associated with the workstation
ok 9 - Created a closed date for 10 days ago
ok 10 - Updated closed date reason
ok 11 - Checkout request returned a HASH
ok 12 - Checkout returned a SUCCESS event
ok 13 - Checkout response object has payload object
ok 14 - Payload object has circ object
ok 15 - Circ objection has loan duration of "7 days"
ok 16 - Item with id = 1310 has status of Checked Out after fresh Storage request
ok 17 - Zero bills associated with circulation
ok 18 - rewrote circ to have happened 20 days ago
ok 19 - Checkin request returned a HASH
ok 20 - Checkin returned a SUCCESS event
ok 21 - Item with id = 1310 has status of Reshelving or Available after fresh Storage request
ok 22 - Twelve bills associated with circulation (instead of 13, thanks to closed date)
ok 23 - Removed closed date

tags: added: pullrequest
Changed in evergreen:
assignee: Jason Etheridge (phasefx) → nobody
Revision history for this message
Ben Shum (bshum) wrote :

Based on what was expected from the notes above, I think the tests have been corrected to fix the errors.

Pushed to master for hopefully happier live tests.

Changed in evergreen:
milestone: none → 2.next
status: In Progress → Fix Committed
Revision history for this message
Ben Shum (bshum) wrote :

Changing milestone to reflect real target of 2.8 series - 2.8 beta, here we come!

Changed in evergreen:
milestone: 2.next → 2.8-beta
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.