Bug 20531 - IssueSlip is failing randomly
Summary: IssueSlip is failing randomly
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low minor
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 25551
  Show dependency treegraph
 
Reported: 2018-04-05 19:45 UTC by Jonathan Druart
Modified: 2020-05-20 12:26 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 20531: Prevent IssueSlip.t to fail randomly (1.08 KB, patch)
2018-04-05 19:52 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 20531: Add diag to help debug next failure (1.27 KB, patch)
2018-04-25 15:17 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 20531: Set the timestamps to the same value to get a correct order (985 bytes, patch)
2018-04-25 20:39 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 20531: (follow-up) Set the timestamps to the same value to get a correct order (1.00 KB, patch)
2018-05-07 15:23 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2018-04-05 19:45:49 UTC
There is sort on timestamp, issuedate, issue_id in Koha::Patron->pending_checkouts (previously GetPendingIssues)

If at least 1 sec passed between 2 inserts, the tests will fail:

https://jenkins.koha-community.org/job/Koha_Master_D8/422/console

koha_1       |         #   Failed test 'IssueSlip should return a slip with 2 checkouts'
koha_1       |         #   at t/db_dependent/Members/IssueSlip.t line 243.
koha_1       |         #          got: 'Checked out:
koha_1       |         # 
koha_1       |         # Title: My title 2
koha_1       |         # Barcode: BC0202
koha_1       |         # Date due: 04/05/2018 19:59
koha_1       |         # 
koha_1       |         # 
koha_1       |         # Title: My title 1
koha_1       |         # Barcode: BC0101
koha_1       |         # Date due: 04/05/2018 19:59
koha_1       |         # 
koha_1       |         # 
koha_1       |         # Overdues:
koha_1       |         # 
koha_1       |         # '
koha_1       |         #     expected: 'Checked out:
koha_1       |         # 
koha_1       |         # Title: My title 1
koha_1       |         # Barcode: BC0101
koha_1       |         # Date due: 04/05/2018 19:59
koha_1       |         # 
koha_1       |         # 
koha_1       |         # Title: My title 2
koha_1       |         # Barcode: BC0202
koha_1       |         # Date due: 04/05/2018 19:59
koha_1       |         # 
koha_1       |         # 
koha_1       |         # Overdues:
koha_1       |         # 
koha_1       |         # '
koha_1       |         # Looks like you failed 1 test of 2.
koha_1       | 
koha_1       |     #   Failed test 'Hourly loans'
koha_1       |     #   at t/db_dependent/Members/IssueSlip.t line 278.
koha_1       |     # Looks like you failed 1 test of 3.
koha_1       | 
koha_1       | #   Failed test 'Issue slip'
koha_1       | #   at t/db_dependent/Members/IssueSlip.t line 280.
koha_1       | # Looks like you failed 1 test of 3.
koha_1       | [18:15:19] t/db_dependent/Members/IssueSlip.t .............................
Comment 1 Jonathan Druart 2018-04-05 19:46:19 UTC
Note: I do not think it has been caused by bug 19935.
Comment 2 Jonathan Druart 2018-04-05 19:52:26 UTC
Created attachment 73721 [details] [review]
Bug 20531: Prevent IssueSlip.t to fail randomly
Comment 3 Jonathan Druart 2018-04-05 19:53:05 UTC
Pushed to master for 18.05

RMaints: This fix uses the newly added dependency libtest-mocktime-perl (bug 20191)
Comment 4 Jonathan Druart 2018-04-25 15:09:17 UTC
Still failing:
https://jenkins.koha-community.org/job/Koha_Master_D8/455/console
Comment 5 Jonathan Druart 2018-04-25 15:17:40 UTC
Created attachment 74847 [details] [review]
Bug 20531: Add diag to help debug next failure

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 6 Jonathan Druart 2018-04-25 15:22:42 UTC
Last patch pushed, diag added. Let's wait next failure...
Comment 7 Jonathan Druart 2018-04-25 20:39:08 UTC
That was quick!

https://jenkins.koha-community.org/job/Koha_Master_D8/457/console

koha_1       |         # $VAR1 = [
koha_1       |         #           {
koha_1       |         #             'onsite_checkout' => '0',
koha_1       |         #             'borrowernumber' => '2000000167',
koha_1       |         #             'branchcode' => 'rFO7HD',
koha_1       |         #             'itemnumber' => '1193',
koha_1       |         #             'date_due' => '2018-04-25 21:59:00',
koha_1       |         #             'auto_renew' => '0',
koha_1       |         #             'note' => undef,
koha_1       |         #             'notedate' => undef,
koha_1       |         #             'timestamp' => '2018-04-25 20:20:45',
koha_1       |         #             'returndate' => undef,
koha_1       |         #             'issue_id' => '94',
koha_1       |         #             'issuedate' => '2018-04-25 21:58:45',
koha_1       |         #             'auto_renew_error' => undef,
koha_1       |         #             'lastreneweddate' => undef,
koha_1       |         #             'renewals' => undef
koha_1       |         #           },
koha_1       |         #           {
koha_1       |         #             'auto_renew_error' => undef,
koha_1       |         #             'issuedate' => '2018-04-24 20:20:45',
koha_1       |         #             'lastreneweddate' => undef,
koha_1       |         #             'renewals' => undef,
koha_1       |         #             'itemnumber' => '1194',
koha_1       |         #             'branchcode' => 'rFO7HD',
koha_1       |         #             'borrowernumber' => '2000000167',
koha_1       |         #             'onsite_checkout' => '0',
koha_1       |         #             'issue_id' => '95',
koha_1       |         #             'returndate' => undef,
koha_1       |         #             'timestamp' => '2018-04-25 20:20:46',
koha_1       |         #             'auto_renew' => '0',
koha_1       |         #             'date_due' => '2018-04-25 21:59:00',
koha_1       |         #             'note' => undef,
koha_1       |         #             'notedate' => undef
koha_1       |         #           }
koha_1       |         #         ];
koha_1       |         # Looks like you failed 1 test of 2.
Comment 8 Jonathan Druart 2018-04-25 20:39:40 UTC
Created attachment 74867 [details] [review]
Bug 20531: Set the timestamps to the same value to get a correct order
Comment 9 Jonathan Druart 2018-05-07 15:20:53 UTC
koha_1       |         #   Failed test 'IssueSlip should return a slip with 2 checkouts'
koha_1       |         #   at t/db_dependent/Members/IssueSlip.t line 181.
koha_1       |         #          got: 'Checked out:
koha_1       |         # 
koha_1       |         # Title: My title 2
koha_1       |         # Barcode: BC0202
koha_1       |         # Date due: 05/07/2018 23:59
koha_1       |         # 
koha_1       |         # 
koha_1       |         # Title: My title 1
koha_1       |         # Barcode: BC0101
koha_1       |         # Date due: 05/07/2018 23:59
koha_1       |         # 
koha_1       |         # 
koha_1       |         # Overdues:
koha_1       |         # 
koha_1       |         # '
koha_1       |         #     expected: 'Checked out:
koha_1       |         # 
koha_1       |         # Title: My title 1
koha_1       |         # Barcode: BC0101
koha_1       |         # Date due: 05/07/2018 23:59
koha_1       |         # 
koha_1       |         # 
koha_1       |         # Title: My title 2
koha_1       |         # Barcode: BC0202
koha_1       |         # Date due: 05/07/2018 23:59
koha_1       |         # 
koha_1       |         # 
koha_1       |         # Overdues:
koha_1       |         # 
koha_1       |         # '
koha_1       |         # Looks like you failed 1 test of 2.
koha_1       | 
koha_1       |     #   Failed test 'Daily loans'
koha_1       |     #   at t/db_dependent/Members/IssueSlip.t line 214.
koha_1       |     # Looks like you failed 1 test of 3.
koha_1       | 
koha_1       | #   Failed test 'Issue slip'
koha_1       | #   at t/db_dependent/Members/IssueSlip.t line 289.
koha_1       | # Looks like you failed 1 test of 3.
koha_1       | [14:51:08] t/db_dependent/Members/IssueSlip.t .............................
Comment 10 Jonathan Druart 2018-05-07 15:23:15 UTC
Created attachment 75135 [details] [review]
Bug 20531: (follow-up) Set the timestamps to the same value to get a correct order

There were 2 places where it was failing!