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 .............................
Note: I do not think it has been caused by bug 19935.
Created attachment 73721 [details] [review] Bug 20531: Prevent IssueSlip.t to fail randomly
Pushed to master for 18.05 RMaints: This fix uses the newly added dependency libtest-mocktime-perl (bug 20191)
Still failing: https://jenkins.koha-community.org/job/Koha_Master_D8/455/console
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>
Last patch pushed, diag added. Let's wait next failure...
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.
Created attachment 74867 [details] [review] Bug 20531: Set the timestamps to the same value to get a correct order
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 .............................
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!