[Bug 31133] New: TestBuilder fragile on virtual fks
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 Bug ID: 31133 Summary: TestBuilder fragile on virtual fks Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org As exposed with the introduction of Koha::Checkouts::Renewal(s), which has two relationships (checkout and old_checkout) defined at the DBIC level (and not at DB level) that point the same column name, to the same fk name, TestBuilder fails in some situations. Looking at the code I found there's some code for detecting duplicate fk introduced by bug 16155, but it doesn't seem to be effective: it fails randomly depending on the key that is picked. I will submit my attempt to make things work, but more eyes are needed. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart+koha@gmail. | |com, | |kyle@bywatersolutions.com, | |m.de.rooy@rijksmuseum.nl, | |martin.renvoize@ptfs-europe | |.com, | |nick@bywatersolutions.com, | |nugged@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=16155 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |30275 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30275 [Bug 30275] Checkout renewals should be stored in their own table -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |24857 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24857 [Bug 24857] Add ability to group items for records -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 137599 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=137599&action=edit Bug 31133: Regression tests (1) Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 137600 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=137600&action=edit Bug 31133: Add a way to handle multiple relationships on same column This patch introduces a syntax for TestBuilder so we can specify which is the preferred relationship in situations like Koha::Checkouts::Renewals that have more than one virtual FK [1] for the same column. In this case, there are the following relationships: * checkouts * old_checkouts both of which link the *checkout_id* column to the *issue_id* column of the **issues** and **old_issues** tables respectively. It does so by defining a mapping between the (concatenated, maybe multiple) related source column and foreign counterpart. The mapping structure is explained in the POD. To test: 1. Apply the regression tests 2. Run the tests a couple times: $ kshell k$ prove t/db_dependent/TestBuilder_multi_vfk.t => FAIL: Tests fail often, randomly! 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! No random failures! 5. Bonus, run: $ kshell k$ prove t/db_dependent/TestBuilder.t => FAIL: It fails consistently about Koha::Biblio::ItemGroup [1] i.e. defined at DBIC level but not present on the DB structure. DISCLAIMER: This is not a complete solution as it still requires a way to override the hardcoded default. This would require a special syntax for build() and build_object() which I prefer to delay until we really need it. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Ok, this should cover one part of the problem. There's still Koha::Biblio::ItemGroup which is failing, ran out of fuel today/yesterday, late already :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 --- Comment #4 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Did you notice that "Bug 30275: (QA follow-up) Trivial fix to schema file" fixes this problem? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 --- Comment #5 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- (In reply to Jonathan Druart from comment #4)
Did you notice that "Bug 30275: (QA follow-up) Trivial fix to schema file" fixes this problem?
Hum no, it did not! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 --- Comment #6 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 137603 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=137603&action=edit [ALTERNATIVE-PATCH] Bug 31133: Don't generate values for more than one FK -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 --- Comment #7 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- What about this alternative, Tomas? At least we won't have more code to add for other specific cases. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 --- Comment #8 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- That's pretty elegant and simple.. I like -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #137603|0 |1 is obsolete| | --- Comment #9 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 137604 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=137604&action=edit [ALTERNATIVE-PATCH] Bug 31133: Don't generate values for more than one FK -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 --- Comment #10 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- It was not working, randomly failing! The second patch should be correct. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 --- Comment #11 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Note that I don't get any other failures, t/db_dependent/TestBuilder.t is passing. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 --- Comment #12 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Note that I don't get any other failures, t/db_dependent/TestBuilder.t is passing.(In reply to Jonathan Druart from comment #11)
Note that I don't get any other failures, t/db_dependent/TestBuilder.t is passing.
Wrong! Hard morning... Can't use string ("Koha::Biblio::ItemGroup") as a HASH ref while "strict refs" in use at /kohadevbox/koha/Koha/Object.pm line 830. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 --- Comment #13 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- (In reply to Tomás Cohen Arazi from comment #3)
Ok, this should cover one part of the problem. There's still Koha::Biblio::ItemGroup which is failing, ran out of fuel today/yesterday, late already :-D
I've attached a patch on bug 24857 for that: "Bug 24857: Remove object_class from singular classes". -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 --- Comment #14 from Tomás Cohen Arazi <tomascohen@gmail.com> --- My first implementation was similar to Jonathan's. The 'problem' was that it randomly generated old_issues and it felt like a very rare use case. It felt like it was better to just have a default resolution path. I'm fine with either. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #137599|0 |1 is obsolete| | Attachment #137600|0 |1 is obsolete| | Attachment #137604|0 |1 is obsolete| | --- Comment #15 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 137634 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=137634&action=edit Bug 31133: Don't generate values for more than one FK Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |22.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 --- Comment #16 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Pushed to master for 22.11. Nice work everyone, thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 Bug 31133 depends on bug 24857, which changed state. Bug 24857 Summary: Add ability to group items for records https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24857 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |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=31133 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |RESOLVED CC| |lucas@bywatersolutions.com Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31133 Bug 31133 depends on bug 30275, which changed state. Bug 30275 Summary: Checkout renewals should be stored in their own table https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30275 What |Removed |Added ---------------------------------------------------------------------------- Status|Needs documenting |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org