[Koha-devel] Bug 7736 and t/db_dependent/TestBuilder.t

Tajoli Zeno z.tajoli at cineca.it
Tue Oct 27 13:09:20 CET 2015


Hi to all,

working on bug 7736, after insert code and update db, I find problem 
with this test:
prove t/db_dependent/TestBuilder

This is the error that I receviee:

t/db_dependent/TestBuilder.t .. 3/41 DBD::mysql::st execute failed: 
Cannot delete or update a parent row: a foreign key constraint fails 
(`koha`.`edifact_messages`, CONSTRAINT `emfk_basketno` FOREIGN KEY 
(`basketno`) REFERENCES `aqbasket` (`basketno`)) [for Statement "DELETE 
FROM `aqbasket` WHERE ( `basketno` = ? )" with ParamValues: 0='37'] at 
/usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1593.

DBIx::Class::ResultSet::delete_all(): Cannot delete or update a parent 
row: a foreign key constraint fails (`koha`.`edifact_messages`, 
CONSTRAINT `emfk_basketno` FOREIGN KEY (`basketno`) REFERENCES 
`aqbasket` (`basketno`)) at /production/develops/t/lib/TestBuilder.pm 
line 94
DBIx::Class::Carp::__ANON__(): A DBIx::Class::Storage::TxnScopeGuard 
went out of scope without explicit commit or error. Rolling back. at 
/usr/share/perl5/DBIx/Class/Storage/TxnScopeGuard.pm line 132

# Looks like you planned 41 tests but ran 35.
# Looks like your test exited with 255 just after 35.

t/db_dependent/TestBuilder.t .. Dubious, test returned 255 (wstat 65280, 
0xff00)
Failed 6/41 subtests

Test Summary Report
-------------------
t/db_dependent/TestBuilder.t (Wstat: 65280 Tests: 35 Failed: 0)
   Non-zero exit status: 255
   Parse errors: Bad plan.  You planned 41 tests but ran 35.
Files=1, Tests=35,  9 wallclock secs ( 0.04 usr  0.01 sys +  7.54 cusr 
0.24 csys =  7.83 CPU)
Result: FAIL

The bug 7736 add 3 table to Koha:

edifact_ean
table vendor_edi_accounts
table edifact_messages
vendor_edi_accounts

with does constraints

CREATE TABLE IF NOT EXISTS vendor_edi_accounts (
...
   CONSTRAINT vfk_vendor_id FOREIGN KEY ( vendor_id ) REFERENCES 
aqbooksellers ( id ),
   CONSTRAINT vfk_shipment_budget FOREIGN KEY ( shipment_budget ) 
REFERENCES aqbudgets ( budget_id )
...
)

CREATE TABLE IF NOT EXISTS edifact_messages (
...
   CONSTRAINT emfk_vendor FOREIGN KEY ( vendor_id ) REFERENCES 
aqbooksellers ( id ),
   CONSTRAINT emfk_edi_acct FOREIGN KEY ( edi_acct ) REFERENCES 
vendor_edi_accounts ( id ),
   CONSTRAINT emfk_basketno FOREIGN KEY ( basketno ) REFERENCES aqbasket 
( basketno )
...
)

ALTER TABLE aqinvoices ADD COLUMN message_id INT(11) REFERENCES 
edifact_messages( id );

ALTER TABLE aqinvoices ADD CONSTRAINT edifact_msg_fk FOREIGN KEY ( 
message_id ) REFERENCES edifact_messages ( id ) ON DELETE SET NULL;

CREATE TABLE IF NOT EXISTS edifact_ean (
...
  CONSTRAINT efk_branchcode FOREIGN KEY ( branchcode ) REFERENCES 
branches ( branchcode )
...
)

The full update done by bug 7736 is here:
https://github.com/colinsc/koha/blob/edifact_snapshot_150911/installer/data/mysql/atomicupdate/edifact.sql


As I see there is a problem on about this costraint of table 
edifact_messages:
CONSTRAINT emfk_basketno FOREIGN KEY ( basketno ) REFERENCES aqbasket ( 
basketno )

Reading the code of t/db_dependent/TestBuilder.t I don't understand if 
there is problem on how the constraint is done or I need to change
TestBuilder.t.

Do you have any idea ?
Where can i find more info about TestBuilder.t ?

Bye
Zeno Tajoli

-- 
Zeno Tajoli
/Dipartimento Sviluppi Innovativi/ - Automazione Biblioteche
Email: z.tajoli at cineca.it Fax: 051/6132198
*CINECA* Consorzio Interuniversitario - Sede operativa di Segrate (MI)


More information about the Koha-devel mailing list