Bug 27892 - api/v1/acquisitions_vendors.t is failing randomly
Summary: api/v1/acquisitions_vendors.t is failing randomly
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Chris Cormack
QA Contact: Testopia
URL:
Keywords:
Depends on: 7736
Blocks: 25551
  Show dependency treegraph
 
Reported: 2021-03-08 10:22 UTC by Jonathan Druart
Modified: 2023-07-04 08:43 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:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2021-03-08 10:22:38 UTC
10:51:09 koha_1       | #   Failed test 'No tests run for subtest "list() and delete() tests | authorized user"'
10:51:09 koha_1       | #   at t/db_dependent/api/v1/acquisitions_vendors.t line 112.
10:51:09 koha_1       | DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha_kohadev`.`vendor_edi_accounts`, CONSTRAINT `vfk_vendor_id` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`)) [for Statement "DELETE FROM `aqbooksellers`"] at /kohadevbox/koha/Koha/Objects.pm line 208
10:51:09 koha_1       | # Looks like your test exited with 255 just after 1.

Master_D9 (#1590)

Looks like we are missing a "on delete cascade" on vendor_edi_accounts
Comment 1 Tomás Cohen Arazi 2021-03-08 10:39:01 UTC
The easy fix would be to call:

$schema->resultset('VendorEdiAccount')->search->delete;

but are we hiding some error?

On the other hand, we might want the query to fail, so we can notify deleting is not possible and user intervention is needed (i.e. maybe we really want Koha::Acquisition::Booksellers->search->delete to fail).
Comment 2 Katrin Fischer 2023-07-01 18:08:23 UTC
This is 2 years old - still valid?
Comment 3 Jonathan Druart 2023-07-04 08:43:53 UTC
(In reply to Katrin Fischer from comment #2)
> This is 2 years old - still valid?

Yes.