[Bug 10653] New: UT : C4::RotatingCollections.pm needs unit tests.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 Bug ID: 10653 Summary: UT : C4::RotatingCollections.pm needs unit tests. Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Test Suite Assignee: gmcharlt@gmail.com Reporter: kenza.zaki@biblibre.com QA Contact: testopia@bugs.koha-community.org -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 kenza <kenza.zaki@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |kenza.zaki@biblibre.com Assignee|gmcharlt@gmail.com |kenza.zaki@biblibre.com -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 kenza <kenza.zaki@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 --- Comment #1 from kenza <kenza.zaki@biblibre.com> --- Created attachment 19985 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=19985&action=edit Bug 10653: C4::RotatingCollections.pm needs unit tests The tests are wrap in a database transaction. Test plan: prove t/db_dependent/RotatingCollections.pm t/db_dependent/RotatingCollections.pm .. 1/41 attempting to use non-existent class sorting routine Use of uninitialized value $cn_class in concatenation (.) or string at C4/ClassSortRoutine.pm line 118. Use of uninitialized value $cn_item in concatenation (.) or string at C4/ClassSortRoutine.pm line 118. Use of uninitialized value $cn_class in concatenation (.) or string at C4/ClassSortRoutine.pm line 118. Use of uninitialized value $cn_item in concatenation (.) or string at C4/ClassSortRoutine.pm line 118. t/db_dependent/RotatingCollections.pm .. ok All tests successful. Files=1, Tests=41, 2 wallclock secs ( 0.04 usr 0.02 sys + 0.99 cusr 0.08 csys = 1.13 CPU) Result: PASS -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 kenza <kenza.zaki@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #19985|0 |1 is obsolete| | --- Comment #2 from kenza <kenza.zaki@biblibre.com> --- Created attachment 19986 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=19986&action=edit Bug 10653: C4::RotatingCollections.pm needs unit tests The tests are wrap in a database transaction. Test plan: prove t/db_dependent/RotatingCollections.t t/db_dependent/RotatingCollections.t .. 1/41 attempting to use non-existent class sorting routine Use of uninitialized value $cn_class in concatenation (.) or string at C4/ClassSortRoutine.pm line 118. Use of uninitialized value $cn_item in concatenation (.) or string at C4/ClassSortRoutine.pm line 118. Use of uninitialized value $cn_class in concatenation (.) or string at C4/ClassSortRoutine.pm line 118. Use of uninitialized value $cn_item in concatenation (.) or string at C4/ClassSortRoutine.pm line 118. t/db_dependent/RotatingCollections.t .. ok All tests successful. Files=1, Tests=41, 2 wallclock secs ( 0.04 usr 0.02 sys + 0.99 cusr 0.08 csys = 1.13 CPU) Result: PASS -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 Srdjan Jankovic <srdjan@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |srdjan@catalyst.net.nz --- Comment #3 from Srdjan Jankovic <srdjan@catalyst.net.nz> --- t/db_dependent/RotatingCollections.t .. 1/41 DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON UPDATE CASCADE) at t/db_dependent/RotatingCollections.t line 41. DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON UPDATE CASCADE) at t/db_dependent/RotatingCollections.t line 41. Is my db out of sync? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 kenza <kenza.zaki@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |10642 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 --- Comment #4 from kenza <kenza.zaki@biblibre.com> --- (In reply to Srdjan Jankovic from comment #3)
t/db_dependent/RotatingCollections.t .. 1/41 DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON UPDATE CASCADE) at t/db_dependent/RotatingCollections.t line 41. DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON UPDATE CASCADE) at t/db_dependent/RotatingCollections.t line 41.
Is my db out of sync?
I just try and indeed if i just do prove t/db_dependent/RotatingCollections.t , i have the same errors. But if i'm in root or if i do sudo prove t/db_dependent/RotatingCollections.t, it works! I really don't understand why. I'll try to fix this problem... -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 kenza <kenza.zaki@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #19986|0 |1 is obsolete| | --- Comment #5 from kenza <kenza.zaki@biblibre.com> --- Created attachment 20106 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=20106&action=edit Bug 10653: C4::RotatingCollections.pm needs unit tests The tests are wrap in a database transaction. Test plan: prove t/db_dependent/RotatingCollections.t t/db_dependent/RotatingCollections.t .. 1/41 attempting to use non-existent class sorting routine Use of uninitialized value $cn_class in concatenation (.) or string at C4/ClassSortRoutine.pm line 118. Use of uninitialized value $cn_item in concatenation (.) or string at C4/ClassSortRoutine.pm line 118. Use of uninitialized value $cn_class in concatenation (.) or string at C4/ClassSortRoutine.pm line 118. Use of uninitialized value $cn_item in concatenation (.) or string at C4/ClassSortRoutine.pm line 118. t/db_dependent/RotatingCollections.t .. ok All tests successful. Files=1, Tests=41, 2 wallclock secs ( 0.04 usr 0.02 sys + 0.99 cusr 0.08 csys = 1.13 CPU) Result: PASS -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 --- Comment #6 from kenza <kenza.zaki@biblibre.com> --- (In reply to kenza from comment #5)
Created attachment 20106 [details] [review] Bug 10653: C4::RotatingCollections.pm needs unit tests
The tests are wrap in a database transaction.
Test plan: prove t/db_dependent/RotatingCollections.t t/db_dependent/RotatingCollections.t .. 1/41 attempting to use non-existent class sorting routine Use of uninitialized value $cn_class in concatenation (.) or string at C4/ClassSortRoutine.pm line 118. Use of uninitialized value $cn_item in concatenation (.) or string at C4/ClassSortRoutine.pm line 118. Use of uninitialized value $cn_class in concatenation (.) or string at C4/ClassSortRoutine.pm line 118. Use of uninitialized value $cn_item in concatenation (.) or string at C4/ClassSortRoutine.pm line 118. t/db_dependent/RotatingCollections.t .. ok All tests successful. Files=1, Tests=41, 2 wallclock secs ( 0.04 usr 0.02 sys + 0.99 cusr 0.08 csys = 1.13 CPU) Result: PASS
I add the deletion of 'categories' ,'branches' and 'branchcategories'. It should work but it still not: if i do : prove t/db_dependent/RotatingCollections.t t/db_dependent/RotatingCollections.t .. 1/41 DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`borrowers`, CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)) at t/db_dependent/RotatingCollections.t line 41. DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`borrowers`, CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)) at t/db_dependent/RotatingCollections.t line 41. # Looks like you planned 41 tests but ran 2. # Looks like your test exited with 255 just after 2. t/db_dependent/RotatingCollections.t .. Dubious, test returned 255 (wstat 65280, 0xff00) Failed 39/41 subtests Test Summary Report ------------------- t/db_dependent/RotatingCollections.t (Wstat: 65280 Tests: 2 Failed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 41 tests but ran 2. Files=1, Tests=2, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.34 cusr 0.02 csys = 0.38 CPU) Result: FAIL But if i do: sudo prove t/db_dependent/RotatingCollections.t t/db_dependent/RotatingCollections.t .. 1/41 attempting to use non-existent class sorting routine Use of uninitialized value $cn_class in concatenation (.) or string at C4/ClassSortRoutine.pm line 118. Use of uninitialized value $cn_item in concatenation (.) or string at C4/ClassSortRoutine.pm line 118. Use of uninitialized value $cn_class in concatenation (.) or string at C4/ClassSortRoutine.pm line 118. Use of uninitialized value $cn_item in concatenation (.) or string at C4/ClassSortRoutine.pm line 118. t/db_dependent/RotatingCollections.t .. ok All tests successful. Files=1, Tests=41, 1 wallclock secs ( 0.02 usr 0.00 sys + 0.37 cusr 0.00 csys = 0.39 CPU) Result: PASS I really don't understand ! So if someone has an idea which can help me... -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 --- Comment #7 from Srdjan Jankovic <srdjan@catalyst.net.nz> --- That's because you have DELETE FROM branches. You can try placing DELETE FROM borrowers before branches, but then you'll have problems with issues. And if you add DELETE FROM issues it will take forever to do that. I think that deleting from base tables is a bad idea. Unlike deleting from specific purpose tables, eg issuingrules, which is ok. I can see that test have progressed in the past couple of years, so this may not be relevant, but what I used to do is either: a) create my own data b) use random existing data, ie SELECT * FROM branches WHERE some_condition ORDER BY random, and take the top one; some_condition is eg has borrowers etc. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 --- Comment #8 from kenza <kenza.zaki@biblibre.com> --- Created attachment 20161 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=20161&action=edit Bug 10642 : Inappropriate uses of $sth->finish() in C4::RotatingCollections.pm
From the man page
finish() Indicate that no more data will be fetched from this statement handle before it is either executed again or destroyed. You almost certainly do not need to call this method. Adding calls to "finish" after loop that fetches all rows is a common mistake, don't do it, it can mask genuine problems like uncaught fetch errors. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 kenza <kenza.zaki@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #20161|1 |0 is patch| | Attachment #20161|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 kenza <kenza.zaki@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #20106|0 |1 is obsolete| | --- Comment #9 from kenza <kenza.zaki@biblibre.com> --- Created attachment 20162 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=20162&action=edit Bug 10653: C4::RotatingCollections.pm needs unit tests The tests are wrap in a database transaction. Test plan: prove t/db_dependent/RotatingCollections.t t/db_dependent/RotatingCollections.t .. ok All tests successful. Files=1, Tests=41, 20 wallclock secs ( 0.02 usr 0.01 sys + 0.41 cusr 0.02 csys = 0.46 CPU) Result: PASS -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #20162|0 |1 is obsolete| | --- Comment #10 from Chris Cormack <chris@bigballofwax.co.nz> --- Created attachment 20201 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=20201&action=edit Bug 10653: C4::RotatingCollections.pm needs unit tests The tests are wrap in a database transaction. Test plan: prove t/db_dependent/RotatingCollections.t t/db_dependent/RotatingCollections.t .. ok All tests successful. Files=1, Tests=41, 20 wallclock secs ( 0.02 usr 0.01 sys + 0.41 cusr 0.02 csys = 0.46 CPU) Result: PASS Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #20201|0 |1 is obsolete| | --- Comment #11 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 20424 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=20424&action=edit Bug 10653: C4::RotatingCollections.pm needs unit tests The tests are wrap in a database transaction. Test plan: prove t/db_dependent/RotatingCollections.t t/db_dependent/RotatingCollections.t .. ok All tests successful. Files=1, Tests=41, 20 wallclock secs ( 0.02 usr 0.01 sys + 0.41 cusr 0.02 csys = 0.46 CPU) Result: PASS Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 Galen Charlton <gmcharlt@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |gmcharlt@gmail.com --- Comment #12 from Galen Charlton <gmcharlt@gmail.com> --- Pushed to master along with a follow-up. Thanks, Kenza! -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable CC| |tomascohen@gmail.com --- Comment #13 from Tomás Cohen Arazi <tomascohen@gmail.com> --- This patch has been pushed to 3.12.x, will be in 3.12.5. Thanks Kenza! -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |master -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bgkriegel@gmail.com --- Comment #14 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> --- Pushed to 3.10.x, will be in 3.10.11 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10653 Chris Hall <chrish@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chrish@catalyst.net.nz --- Comment #15 from Chris Hall <chrish@catalyst.net.nz> --- Pushed to 3.8.x, will be in 3.8.19. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org