| Summary: | Several tests failing for t/db_dependent/Reserves.t | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Emmi Takkinen <emmi.takkinen> |
| Component: | Test Suite | Assignee: | Emmi Takkinen <emmi.takkinen> |
| Status: | RESOLVED INVALID | QA Contact: | Testopia <testopia> |
| Severity: | enhancement | ||
| Priority: | P5 - low | CC: | lari.taskula, matthias.le-gac |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | --- |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: | Version(s) released in: | ||
| Circulation function: | |||
| Attachments: | Bug 32340: Fix t/db_dependent/Reserves.t tests | ||
|
Description
Emmi Takkinen
2022-11-24 11:34:01 UTC
So it seems I'm missing few notices from my test environment. I can understand that tests assume that HOLD and HOLD_SLIP are present, they are included in sample notices. But I can't find any traces of this HOLD_CANCELLATION notice, are we missing it from sample_notices.yml? I noticed the same warning for HOLD_CANCELLATION and figured out it was removed in Bug 27103. But I believe this warning can be ignored. Hi Emmi, the tests pass for me on master with the sample database. I believe the sample data is assumed. (In reply to Katrin Fischer from comment #3) > Hi Emmi, the tests pass for me on master with the sample database. I believe > the sample data is assumed. Yep, but my sample data is no longer contains HOLD_CANCELLATION letter, I've probably deleted it at some point. Added it manually and tests no longer complain it missing. However I'm getting a whole new batch of errors now: t/db_dependent/Reserves.t .. 2/77 Use of uninitialized value $email in string ne at /home/emmi/Koha/Koha/Patron.pm line 1445. Use of uninitialized value $email in string ne at /home/emmi/Koha/Koha/Patron.pm line 1445. Use of uninitialized value $email in string ne at /home/emmi/Koha/Koha/Patron.pm line 1445. Use of uninitialized value $email in string ne at /home/emmi/Koha/Koha/Patron.pm line 1445. Use of uninitialized value $email in string ne at /home/emmi/Koha/Koha/Patron.pm line 1445. Use of uninitialized value $email in string ne at /home/emmi/Koha/Koha/Patron.pm line 1445. Can't call method "can_edit_items_from" on an undefined value at /home/emmi/Koha/Koha/Item.pm line 298. (In reply to Emmi Takkinen from comment #4) > (In reply to Katrin Fischer from comment #3) > > Hi Emmi, the tests pass for me on master with the sample database. I believe > > the sample data is assumed. > > Yep, but my sample data is no longer contains HOLD_CANCELLATION letter, I've > probably deleted it at some point. Added it manually and tests no longer > complain it missing. However I'm getting a whole new batch of errors now: > > t/db_dependent/Reserves.t .. 2/77 Use of uninitialized value $email in > string ne at /home/emmi/Koha/Koha/Patron.pm line 1445. > Use of uninitialized value $email in string ne at > /home/emmi/Koha/Koha/Patron.pm line 1445. > Use of uninitialized value $email in string ne at > /home/emmi/Koha/Koha/Patron.pm line 1445. > Use of uninitialized value $email in string ne at > /home/emmi/Koha/Koha/Patron.pm line 1445. > Use of uninitialized value $email in string ne at > /home/emmi/Koha/Koha/Patron.pm line 1445. > Use of uninitialized value $email in string ne at > /home/emmi/Koha/Koha/Patron.pm line 1445. > Can't call method "can_edit_items_from" on an undefined value at > /home/emmi/Koha/Koha/Item.pm line 298. Hmm, this could happen because we don't mock user environment somewhere in the code. I just ran into similar problem in bug 34152. Yep mocking user environment for manager does the trick.
Also got this one as a new:
t/db_dependent/Reserves.t .. 73/77
# Failed test 'Reserve date set 1 year from today'
# at t/db_dependent/Reserves.t line 1758.
# got: '2388-06-30'
# expected: '2024-06-29'
# Looks like you failed 1 test of 2.
# Failed test 'DefaultHoldExpiration tests'
# at t/db_dependent/Reserves.t line 1761.
# Looks like you failed 2 tests of 77.
There's a typo in this line:
t::lib::Mocks::mock_preference( 'DefaultHoldExpirationUnitOfTime', 'days;' );
Created attachment 152903 [details] [review] Bug 32340: Fix t/db_dependent/Reserves.t tests This patch does following fixes: - Get rid of "Use of uninitialized value $email in string ne" warning by adding email for test patrons - Prevent "Can't call method "can_edit_items_from" on an undefined value" by adding mock manager patron - Fix typos in DefaultHoldExpirationdate tests To test: 1) Run prove t/db_dependent/Reserves.t. -> Tests should fail. 2) Apply this patch. 3) Rerun prove t/db_dependent/Reserves.t. -> Success! Sponsored-by: Koha-Suomi Oy After I apply the patch the test doesn't pass.
t/db_dependent/Reserves.t .. 5/77 No reserves HOLD_CANCELLATION letter transported by email at /inlibro/git/koha-master-dev-matthias/C4/Letters.pm line 603.
t/db_dependent/Reserves.t .. 50/77 DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails (`koha_master_dev_matthias`.`accountlines`, CONSTRAINT `accountlines_ibfk_debit_type` FOREIGN KEY (`debit_type_code`) REFERENCES `account_debit_types` (`code`) ON UPDATE CASCADE) at /inlibro/git/koha-master-dev-matthias/Koha/Object.pm line 170
# No tests run!
# Failed test 'No tests run for subtest "ChargeReserveFee tests"'
# at t/db_dependent/Reserves.t line 983.
Exception 'Koha::Exceptions::Account::UnrecognisedType' thrown 'Type of debit not recognised'
# Looks like your test exited with 255 just after 62.
t/db_dependent/Reserves.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 16/77 subtests
Test Summary Report
-------------------
t/db_dependent/Reserves.t (Wstat: 65280 Tests: 62 Failed: 1)
Failed test: 62
Non-zero exit status: 255
Parse errors: Bad plan. You planned 77 tests but ran 62.
Files=1, Tests=62, 3 wallclock secs ( 0.03 usr 0.00 sys + 3.07 cusr 0.16 csys = 3.26 CPU)
Result: FAIL
All tests now pass on current main, so I'm marking this as resolved. |