Bug 24881 - Circulation.t still fails if tests are ran slowly
Summary: Circulation.t still fails if tests are ran slowly
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 22917
Blocks: 25551
  Show dependency treegraph
 
Reported: 2020-03-16 16:19 UTC by Jonathan Druart
Modified: 2021-12-13 21:08 UTC (History)
4 users (show)

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


Attachments
Bug 24881: [19.05.x] Try to fix random failure from Circulation.t (5.63 KB, patch)
2020-03-16 16:20 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 24881: Try to fix random failure from Circulation.t (11.70 KB, patch)
2020-03-18 16:20 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 24881: [19.11.x] Try to fix random failure from Circulation.t (11.39 KB, patch)
2020-05-21 08:24 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 24881: [19.05.x] Try to fix random failure from Circulation.t (6.49 KB, patch)
2020-06-11 09:00 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 2020-03-16 16:19:08 UTC
Bug 22917 - Circulation.t fails if tests are ran slowly

Not fixed, or regression added after.
Comment 1 Jonathan Druart 2020-03-16 16:20:07 UTC
Created attachment 100778 [details] [review]
Bug 24881: [19.05.x] Try to fix random failure from Circulation.t
Comment 2 Jonathan Druart 2020-03-16 16:32:04 UTC
Lucas, if you can recreate that one, could you confirm this patch fixes the failures on 19.05?
Comment 3 Lucas Gass 2020-03-16 16:45:43 UTC
Jonathan, I still get this: 

# Subtest: CanBookBeRenewed tests
    1..71
DBD::mysql::st execute failed: Unknown column 'me.guarantorid' in 'field list' [for Statement "SELECT `me`.`borrowernumber`, `me`.`cardnumber`, `me`.`surname`, `me`.`firstname`, `me`.`title`, `me`.`othernames`, `me`.`initials`, `me`.`streetnumber`, `me`.`streettype`, `me`.`address`, `me`.`address2`, `me`.`city`, `me`.`state`, `me`.`zipcode`, `me`.`country`, `me`.`email`, `me`.`phone`, `me`.`mobile`, `me`.`fax`, `me`.`emailpro`, `me`.`phonepro`, `me`.`B_streetnumber`, `me`.`B_streettype`, `me`.`B_address`, `me`.`B_address2`, `me`.`B_city`, `me`.`B_state`, `me`.`B_zipcode`, `me`.`B_country`, `me`.`B_email`, `me`.`B_phone`, `me`.`dateofbirth`, `me`.`branchcode`, `me`.`categorycode`, `me`.`dateenrolled`, `me`.`dateexpiry`, `me`.`date_renewed`, `me`.`gonenoaddress`, `me`.`lost`, `me`.`debarred`, `me`.`debarredcomment`, `me`.`contactname`, `me`.`contactfirstname`, `me`.`contacttitle`, `me`.`guarantorid`, `me`.`borrowernotes`, `me`.`relationship`, `me`.`sex`, `me`.`password`, `me`.`flags`, `me`.`userid`, `me`.`opacnote`, `me`.`contactnote`, `me`.`sort1`, `me`.`sort2`, `me`.`altcontactfirstname`, `me`.`altcontactsurname`, `me`.`altcontactaddress1`, `me`.`altcontactaddress2`, `me`.`altcontactaddress3`, `me`.`altcontactstate`, `me`.`altcontactzipcode`, `me`.`altcontactcountry`, `me`.`altcontactphone`, `me`.`smsalertnumber`, `me`.`sms_provider_id`, `me`.`privacy`, `me`.`privacy_guarantor_checkouts`, `me`.`checkprevcheckout`, `me`.`updated_on`, `me`.`lastseen`, `me`.`lang`, `me`.`login_attempts`, `me`.`overdrive_auth_token`, `me`.`anonymized` FROM `borrowers` `me` WHERE ( `me`.`borrowernumber` = ? )" with ParamValues: 0='84'] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1836.
    # No tests run!
not ok 15 - No tests run for subtest "CanBookBeRenewed tests"

#   Failed test 'No tests run for subtest "CanBookBeRenewed tests"'
#   at /kohadevbox/koha/t/db_dependent/Circulation.t line 998.
DBD::mysql::st execute failed: Unknown column 'me.guarantorid' in 'field list' [for Statement "SELECT `me`.`borrowernumber`, `me`.`cardnumber`, `me`.`surname`, `me`.`firstname`, `me`.`title`, `me`.`othernames`, `me`.`initials`, `me`.`streetnumber`, `me`.`streettype`, `me`.`address`, `me`.`address2`, `me`.`city`, `me`.`state`, `me`.`zipcode`, `me`.`country`, `me`.`email`, `me`.`phone`, `me`.`mobile`, `me`.`fax`, `me`.`emailpro`, `me`.`phonepro`, `me`.`B_streetnumber`, `me`.`B_streettype`, `me`.`B_address`, `me`.`B_address2`, `me`.`B_city`, `me`.`B_state`, `me`.`B_zipcode`, `me`.`B_country`, `me`.`B_email`, `me`.`B_phone`, `me`.`dateofbirth`, `me`.`branchcode`, `me`.`categorycode`, `me`.`dateenrolled`, `me`.`dateexpiry`, `me`.`date_renewed`, `me`.`gonenoaddress`, `me`.`lost`, `me`.`debarred`, `me`.`debarredcomment`, `me`.`contactname`, `me`.`contactfirstname`, `me`.`contacttitle`, `me`.`guarantorid`, `me`.`borrowernotes`, `me`.`relationship`, `me`.`sex`, `me`.`password`, `me`.`flags`, `me`.`userid`, `me`.`opacnote`, `me`.`contactnote`, `me`.`sort1`, `me`.`sort2`, `me`.`altcontactfirstname`, `me`.`altcontactsurname`, `me`.`altcontactaddress1`, `me`.`altcontactaddress2`, `me`.`altcontactaddress3`, `me`.`altcontactstate`, `me`.`altcontactzipcode`, `me`.`altcontactcountry`, `me`.`altcontactphone`, `me`.`smsalertnumber`, `me`.`sms_provider_id`, `me`.`privacy`, `me`.`privacy_guarantor_checkouts`, `me`.`checkprevcheckout`, `me`.`updated_on`, `me`.`lastseen`, `me`.`lang`, `me`.`login_attempts`, `me`.`overdrive_auth_token`, `me`.`anonymized` FROM `borrowers` `me` WHERE ( `me`.`borrowernumber` = ? )" with ParamValues: 0='84'] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1836.
# Looks like your test exited with 11 just after 15.
Dubious, test returned 11 (wstat 2816, 0xb00)
Failed 32/46 subtests
Comment 4 Jonathan Druart 2020-03-16 18:23:15 UTC
Lucas, this means that you are using a master DB on a 19.05.x branch.
reset_all on 19.05.x and you should not get that error.
Comment 5 Lucas Gass 2020-03-16 19:46:14 UTC
ahh, of course. Thanks Jonathan.
Comment 6 Lucas Gass 2020-03-16 19:52:26 UTC
backported to 19.05.x for 19.05.09
Comment 7 Jonathan Druart 2020-03-16 19:56:55 UTC
(In reply to Lucas Gass from comment #6)
> backported to 19.05.x for 19.05.09

Can you confirm this patch did fix something?

Which error did you get?
Comment 8 Lucas Gass 2020-03-16 19:58:29 UTC
Jonathan, no errors. This makes Circulation.t pass all tests. TY.
Comment 9 Jonathan Druart 2020-03-17 08:01:14 UTC
(In reply to Lucas Gass from comment #8)
> Jonathan, no errors. This makes Circulation.t pass all tests. TY.

I do not understand what happened here.

What are the failing tests this patch fixed? It's not supposed to fix the failures you reported on comment 3.

If other tests are fixed we need to have the patch into master as well.
Comment 10 Lucas Gass 2020-03-17 14:44:26 UTC
Sorry Jonathan,

It fixes Circulation.t tests for me, the problems in comment 3 were my own problem. I wrongly assumed this one was for [19.05.x] only so I pushed to that branch.

I will revert.
Comment 11 Jonathan Druart 2020-03-18 16:07:56 UTC
I forgot if this test was really failing. Holding on for now, until it reappears.
Comment 12 Jonathan Druart 2020-03-18 16:20:38 UTC
Created attachment 100970 [details] [review]
Bug 24881: Try to fix random failure from Circulation.t

This is a follow-up of bug 22917.
Comment 13 Jonathan Druart 2020-03-18 16:21:50 UTC
Sending to RM queue.
Comment 14 Martin Renvoize 2020-03-18 16:30:11 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 15 Joy Nelson 2020-04-03 20:15:40 UTC
does not apply to 19.11.x.  not backported.  please rebase if needed.
Comment 16 Jonathan Druart 2020-05-21 08:24:08 UTC
Created attachment 105169 [details] [review]
Bug 24881: [19.11.x] Try to fix random failure from Circulation.t

This is a follow-up of bug 22917.
Comment 17 Joy Nelson 2020-05-21 20:54:31 UTC
Pushed to 19.11.x for 19.11.06
Comment 18 Victor Grousset/tuxayo 2020-06-03 17:44:41 UTC
Info: patch of comment 1 is still in 19.05.x and isn't not the cause of bug 25665 (test t/db_dependent/Circulation.t fails on a specific date)
Comment 19 Victor Grousset/tuxayo 2020-06-10 16:25:44 UTC
On the CI of branch 19.05 I've had 3 failures on this test (can't replicate locally)

koha_1       |     #   Failed test 'Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays (168h - 24h * 0.25u)'
koha_1       |     #   at t/db_dependent/Circulation.t line 3245.
koha_1       |     #          got: '30'
koha_1       |     #     expected: '36'
koha_1       |     # Looks like you failed 1 test of 20.
koha_1       | 
koha_1       | #   Failed test 'Incremented fee tests'
koha_1       | #   at t/db_dependent/Circulation.t line 3270.
https://jenkins.koha-community.org/view/19.05/job/Koha_19.05_D8/234/consoleText
https://jenkins.koha-community.org/view/19.05/job/Koha_19.05_D9/228/consoleText
https://jenkins.koha-community.org/view/19.05/job/Koha_19.05_U18/229/consoleText

Does this look related to this bug?

It seems to not affect 19.11, 20.05 and master after looking at all the test failure since almost 3 weeks in these branches.
Which is why it might be related to this ticket. As 19.05 seems to be a bit different in regard to was happened in this ticket.
Comment 20 Victor Grousset/tuxayo 2020-06-10 16:28:31 UTC
Locally I can have the following two possible errors. (confirmed only on 19.05.x)
Patch from comment 1 (which in 19.05) doesn't seem to have an impact when kept or reverted.

t/db_dependent/Circulation.t .. 29/46 
    #   Failed test 'ISSUED_TO_ANOTHER question flag should be set if AutoReturnCheckedOutItems is disabled and item is checked out to another'
    #   at t/db_dependent/Circulation.t line 1974.
    #          got: undef
    #     expected: '1'
    # Looks like you planned 2 tests but ran 1.
    # Looks like you failed 1 test of 1 run.
t/db_dependent/Circulation.t .. 30/46 
#   Failed test 'CanBookBeIssued + AutoReturnCheckedOutItems'
#   at t/db_dependent/Circulation.t line 1981.
Can't call method "borrowernumber" on an undefined value at t/db_dependent/Circulation.t line 1978.
# Looks like your test exited with 255 just after 30.


##### And also #####


t/db_dependent/Circulation.t .. 28/46 
    #   Failed test 'AddReturn must have debarred the patron'
    #   at t/db_dependent/Circulation.t line 86.
    #          got: ''
    #     expected: '1'
    # AddReturn returned message $VAR1 = {
    #           'WasReturned' => 1
    #         };

    #   Failed test 'Test at line 1924'
    #   at t/db_dependent/Circulation.t line 90.
    #          got: '0'
    #     expected: '1'

    #   Failed test 'Test at line 1924'
    #   at t/db_dependent/Circulation.t line 93.
    #          got: undef
    #     expected: '2020-06-22'
    # Looks like you failed 3 tests of 21.
t/db_dependent/Circulation.t .. 29/46 
#   Failed test 'AddReturn + suspension_chargeperiod'
#   at t/db_dependent/Circulation.t line 1933.
Comment 21 Jonathan Druart 2020-06-11 09:00:34 UTC
Created attachment 105721 [details] [review]
Bug 24881: [19.05.x] Try to fix random failure from Circulation.t

This is a follow-up of bug 22917.

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
(cherry picked from commit b0551cfd178565b5b30980096f53d4fffcfca454)
Comment 22 Jonathan Druart 2020-06-11 09:01:12 UTC
(In reply to Jonathan Druart from comment #21)
> Created attachment 105721 [details] [review] [review]
> Bug 24881: [19.05.x] Try to fix random failure from Circulation.t
> 
> This is a follow-up of bug 22917.
> 
> Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
> (cherry picked from commit b0551cfd178565b5b30980096f53d4fffcfca454)

Victor, this is a rebased patch of the 19.11.x version.
Comment 23 Victor Grousset/tuxayo 2020-06-11 11:52:40 UTC
I can still get the following error locally. 
I confirm that have applied the patch of comment 21 on top of 19.05.x without reverting the old patch


t/db_dependent/Circulation.t .. 29/46 
    #   Failed test 'ISSUED_TO_ANOTHER question flag should be set if AutoReturnCheckedOutItems is disabled and item is checked out to another'
    #   at t/db_dependent/Circulation.t line 1975.
    #          got: undef
    #     expected: '1'
    # Looks like you planned 2 tests but ran 1.
t/db_dependent/Circulation.t .. 30/46     # Looks like you failed 1 test of 1 run.

#   Failed test 'CanBookBeIssued + AutoReturnCheckedOutItems'
#   at t/db_dependent/Circulation.t line 1982.
Can't call method "borrowernumber" on an undefined value at t/db_dependent/Circulation.t line 1979.
# Looks like your test exited with 255 just after 30.
t/db_dependent/Circulation.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
Comment 24 Victor Grousset/tuxayo 2020-06-11 11:54:27 UTC
Should I push the patch of comment 21 anyway? If we still expect to fix part of the flaky tests.
Comment 25 Jonathan Druart 2020-06-11 13:43:06 UTC
(In reply to Victor Grousset/tuxayo from comment #23)
> I can still get the following error locally. 
> I confirm that have applied the patch of comment 21 on top of 19.05.x
> without reverting the old patch
> 
> 
> t/db_dependent/Circulation.t .. 29/46 
>     #   Failed test 'ISSUED_TO_ANOTHER question flag should be set if
> AutoReturnCheckedOutItems is disabled and item is checked out to another'
>     #   at t/db_dependent/Circulation.t line 1975.
>     #          got: undef
>     #     expected: '1'
>     # Looks like you planned 2 tests but ran 1.
> t/db_dependent/Circulation.t .. 30/46     # Looks like you failed 1 test of
> 1 run.
> 
> #   Failed test 'CanBookBeIssued + AutoReturnCheckedOutItems'
> #   at t/db_dependent/Circulation.t line 1982.
> Can't call method "borrowernumber" on an undefined value at
> t/db_dependent/Circulation.t line 1979.
> # Looks like your test exited with 255 just after 30.
> t/db_dependent/Circulation.t .. Dubious, test returned 255 (wstat 65280,
> 0xff00)

This is because 19.05 is lacking:
    Bug 24062: Make sure TestBuilder will stop generate X or other invalid category's types
Comment 26 Victor Grousset/tuxayo 2020-06-11 13:47:32 UTC
Great find, will try that.
Comment 27 Victor Grousset/tuxayo 2020-06-11 16:11:04 UTC
Backported to 19.05.x branch for 19.05.12