[Bug 22001] New: RaiseError and PrintError flags must be set for tests
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 Bug ID: 22001 Summary: RaiseError and PrintError flags must be set for tests Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: ASSIGNED Severity: enhancement Priority: P5 - low Component: Test Suite Assignee: jonathan.druart@bugs.koha-community.org Reporter: jonathan.druart@bugs.koha-community.org QA Contact: testopia@bugs.koha-community.org Depends on: 14334 Bug 14334 removed some of the RaiseError flags that existed in tests. It should always be set in tests, just in case :) Moreover, patches of bug 14334 could hide a regression, if we have a test catching a crash (using eval), it will no longer explode. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14334 [Bug 14334] DBI fighting DBIx over Autocommit in tests -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 --- Comment #1 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 83230 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=83230&action=edit Bug 22001: Remove the RaiseError occurrences from tests Unless it is needed! Also remove $dbh when not used later. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 --- Comment #2 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 83231 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=83231&action=edit Bug 22001: Add tests -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 --- Comment #3 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 83232 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=83232&action=edit Bug 22001: Enable RaiseError for tests -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 Bug 22001 depends on bug 14334, which changed state. Bug 14334 Summary: DBI fighting DBIx over Autocommit in tests https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14334 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Stable |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #83230|0 |1 is obsolete| | Attachment #83231|0 |1 is obsolete| | Attachment #83232|0 |1 is obsolete| | --- Comment #4 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 98910 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=98910&action=edit Bug 22001: Remove the RaiseError occurrences from tests Unless it is needed! Also remove $dbh when not used later. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 --- Comment #5 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 98911 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=98911&action=edit Bug 22001: Add tests -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 --- Comment #6 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 98912 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=98912&action=edit Bug 22001: Enable RaiseError for tests -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 Mason James <mtj@kohaaloha.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mtj@kohaaloha.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #98910|0 |1 is obsolete| | --- Comment #7 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 99589 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=99589&action=edit Bug 22001: Remove the RaiseError occurrences from tests Unless it is needed! Also remove $dbh when not used later. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #98911|0 |1 is obsolete| | --- Comment #8 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 99590 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=99590&action=edit Bug 22001: Add tests Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #98912|0 |1 is obsolete| | --- Comment #9 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 99591 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=99591&action=edit Bug 22001: Enable RaiseError for tests Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off CC| |martin.renvoize@ptfs-europe | |.com --- Comment #10 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Works as expected.. sorry I didn't spot this one earlier :( -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA --- Comment #11 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- I'm happy with this one.. it's important for us to see the errors being thrown.. Passing QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |20.05.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 --- Comment #12 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work everyone! Pushed to master for 20.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 --- Comment #13 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 101989 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=101989&action=edit Bug 22002: (RM follow-up) Allow RaiseError tests in Reports/Guided.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 --- Comment #14 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 101990 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=101990&action=edit Bug 22001: (RM follow-up) Allow RaiseError tests in Reports/Guided.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 --- Comment #15 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work everyone! Pushed to master for 20.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #101989|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 --- Comment #16 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 101991 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=101991&action=edit Bug 22001: Fix Reports/Guided.t tests -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 --- Comment #17 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 102070 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102070&action=edit Bug 22001: Fix Object.t - handle correct RaiseError and PrintError -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 --- Comment #18 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Final followup pushed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 --- Comment #19 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 102140 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102140&action=edit Bug 22001: Set unsafe only if RaiseError is not set Sooooo.... That was tricky, and the solution looks trivial. However it's not. We have unsafe set for "historical reason". Having it on when RaiseError is on have the effect of overwritting the DBIC error handler. The problem is: t/db_dependent/Circulation/MarkIssueReturned.t (and other tests) is failing with: # expecting: Koha::Exceptions::Object::BadValue # found: DBIx::Class::Exception ({UNKNOWN}: Can't locate object method "rethrow" via package "DBD::mysql::st execute failed: Incorrect datetime value: 'bad_date' for column 'returndate' at row 1 [for Statement "UPDATE `issues` SET `returndate` = ? WHERE ( `issue_id` = ? )" with ParamValues: 0='bad_date', 1=238] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line In Koha::Object->store, the exception is not a DBIx::Class::Exception object (as we except), but a string (on which we cannot call rethrow). Swithing unsafe off restores the expected behavior. To make sure the UI will not be affected, it is only turned off when RaiseError is set. The situation is still wrong (for UI), from the POD https://metacpan.org/pod/DBIx::Class::Storage::DBI (/unsafe) """ Note that your custom settings can cause Storage to malfunction, especially if you set a HandleError handler that suppresses exceptions and/or disable RaiseError. """ And also https://metacpan.org/release/DBIx-Class/source/lib/DBIx/Class/Storage/DBI.pm... Many thanks Tomas for the digging exploration! We need to turn RaiseError and remove the unsafe flag, for UI as well, but that should be done at the beginning of a dev cycle. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |25026 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25026 [Bug 25026] RaiseError must be set for the UI -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 --- Comment #20 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Final followup pushed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 --- Comment #21 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 102147 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102147&action=edit Bug 22001: Add the DBI error message Using DBIx::Class error handler, we should not hide the error when encapsulating it -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 --- Comment #22 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 102149 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102149&action=edit Bug 22001: Make the DBD error regex less strict Now the message is looking like DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Duplicate entry -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 --- Comment #23 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 102150 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102150&action=edit Bug 22001: Fix Koha/Patrons.t The message is only printed once -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 --- Comment #24 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 102151 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102151&action=edit Bug 22001: execute reports in an eval Otherwise the tests will fail. We will certainly log twice the error when run from the UI, but not a big deal. This definitely needs more attention in a follow-up bug report. We want to raise proper exceptions here. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 --- Comment #25 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 102152 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102152&action=edit Bug 22001: Errors are no longer logged by default (!) This is one of the biggest part we will have to deal with when we will switch to DBIC handler for UI as well. The DBI errors will not be logged if we do not deal with them correctly. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 --- Comment #26 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work everyone! Pushed to master for 20.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 Joy Nelson <joy@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |joy@bywatersolutions.com --- Comment #27 from Joy Nelson <joy@bywatersolutions.com> --- enhancement not backported to 19.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |25018 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25018 [Bug 25018] Jenkins is not running the test with $ENV{_} eq 'prove' -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22001 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|RaiseError and PrintError |Add RaiseError and |flags must be set for tests |PrintError flags for all | |tests -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org