[Bug 8846] New: t/SuggestionEngine_ExplodedTerms.t sneakily uses database
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 Priority: P5 - low Change sponsored?: --- Bug ID: 8846 Assignee: jcamins@cpbibliography.com Summary: t/SuggestionEngine_ExplodedTerms.t sneakily uses database Severity: normal Classification: Unclassified OS: All Reporter: jcamins@cpbibliography.com Hardware: All Status: NEW Version: master Component: Test Suite Product: Koha Even though there is no need for anything stored in the database for the test, C4::Templates requires the database. The solution is to mock all database-using routines. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 --- Comment #1 from Jared Camins-Esakov <jcamins@cpbibliography.com> --- Created attachment 12607 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=12607&action=edit Bug 8846: Exploded Terms test sneakily uses database Even though there is no need for anything stored in the database for the test, C4::Templates requires the database. The solution is to mock all database-using routines. To test: 1) Stop MySQL 2) Run test -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #12607|0 |1 is obsolete| | --- Comment #2 from Jared Camins-Esakov <jcamins@cpbibliography.com> --- Created attachment 12617 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=12617&action=edit Bug 8846: Exploded Terms test sneakily uses database Even though there is no need for anything stored in the database for the test, C4::Templates requires the database and a koha-conf.xml. The solution is to mock all database- and koha-conf-using routines. To test: 1) Stop MySQL 2) Unset KOHA_CONF 3) Run test -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #12617|0 |1 is obsolete| | --- Comment #3 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 12710 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=12710&action=edit Bug 8846: Exploded Terms test sneakily uses database Even though there is no need for anything stored in the database for the test, C4::Templates requires the database and a koha-conf.xml. The solution is to mock all database- and koha-conf-using routines. To test: 1) Stop MySQL 2) Unset KOHA_CONF 3) Run test Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Followed test plan, everything checks out. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off CC| |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=8846 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |8890 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P5 - low |P1 - high Severity|normal |blocker -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 Paul Poulain <paul.poulain@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |paul.poulain@biblibre.com --- Comment #4 from Paul Poulain <paul.poulain@biblibre.com> --- QA comment: wouldn't it be better to put Mocking subs in a specific place where they could be reused ? Mocking C4::Languages will probably be very useful for other tests There is already t/lib/Mocks/Context.pm that mocks (very partially) C4::Context isn't it a direction we should follow ? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 --- Comment #5 from Jared Camins-Esakov <jcamins@cpbibliography.com> --- (In reply to comment #4)
QA comment: wouldn't it be better to put Mocking subs in a specific place where they could be reused ? Mocking C4::Languages will probably be very useful for other tests There is already t/lib/Mocks/Context.pm that mocks (very partially) C4::Context
isn't it a direction we should follow ?
I think we definitely need to make it reusable, and my plan is to build in t/lib/Mocks, but I think first we need a better sense of what we're mocking where. Different sysprefs need to be mocked to different values for different tests, and I'd rather have a working test that requires a little bit of refactoring than a non-working test (i.e. one that does not actually test what it is supposed to). This is going to be one of my goals for 3.12. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA CC| |jonathan.druart@biblibre.co | |m --- Comment #6 from Jonathan Druart <jonathan.druart@biblibre.com> --- So, marked as Passed QA. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 --- Comment #7 from Paul Poulain <paul.poulain@biblibre.com> --- mmm... trying to test this patch before pushing, I have a problem 17:18 ~/koha.dev/koha-community (new/bug_8846 $%)$ perl t/db_dependent/SuggestionEngine_ExplodedTerms.t ok 1 - use Koha::SuggestionEngine; ok 2 - Created suggestion engine Template process failed: file error - /home/paul/koha.dev/koha-community/t/db_dependent/../koha-tmpl/opac-tmpl/prog/en/modules/text/explodedterms.tt: not found at /home/paul/koha.dev/koha-community//C4/Templates.pm line 132. # Tests were run but no plan was declared and done_testing() was not seen. where's the mistake ? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 --- Comment #8 from Jared Camins-Esakov <jcamins@cpbibliography.com> --- (In reply to comment #7)
mmm... trying to test this patch before pushing, I have a problem
17:18 ~/koha.dev/koha-community (new/bug_8846 $%)$ perl t/db_dependent/SuggestionEngine_ExplodedTerms.t ok 1 - use Koha::SuggestionEngine; ok 2 - Created suggestion engine Template process failed: file error - /home/paul/koha.dev/koha-community/t/db_dependent/../koha-tmpl/opac-tmpl/ prog/en/modules/text/explodedterms.tt: not found at /home/paul/koha.dev/koha-community//C4/Templates.pm line 132. # Tests were run but no plan was declared and done_testing() was not seen.
where's the mistake ?
The patch moving this test to db_dependent shouldn't have been pushed. This test file must be in t/ -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 --- Comment #9 from Jared Camins-Esakov <jcamins@cpbibliography.com> --- (In reply to comment #8)
(In reply to comment #7)
mmm... trying to test this patch before pushing, I have a problem
17:18 ~/koha.dev/koha-community (new/bug_8846 $%)$ perl t/db_dependent/SuggestionEngine_ExplodedTerms.t ok 1 - use Koha::SuggestionEngine; ok 2 - Created suggestion engine Template process failed: file error - /home/paul/koha.dev/koha-community/t/db_dependent/../koha-tmpl/opac-tmpl/ prog/en/modules/text/explodedterms.tt: not found at /home/paul/koha.dev/koha-community//C4/Templates.pm line 132. # Tests were run but no plan was declared and done_testing() was not seen.
where's the mistake ?
The patch moving this test to db_dependent shouldn't have been pushed. This test file must be in t/
I've continued looking into it, and I think I may have been mistaken. It looks like the problem may be that you don't have opachtdocs set in your koha-conf.xml. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 --- Comment #10 from Paul Poulain <paul.poulain@biblibre.com> --- (In reply to comment #9)
I've continued looking into it, and I think I may have been mistaken. It looks like the problem may be that you don't have opachtdocs set in your koha-conf.xml.
just checked, and I have opachtdocs in my koha-conf.xml = <opachtdocs>/home/paul/koha.dev/koha-community/koha-tmpl/opac-tmpl</opachtdocs> (which point to the correct directory, just checked -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #12710|0 |1 is obsolete| | --- Comment #11 from Jared Camins-Esakov <jcamins@cpbibliography.com> --- Created attachment 13157 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=13157&action=edit Bug 8846: Exploded Terms test sneakily uses database Even though there is no need for anything stored in the database for the test, C4::Templates requires the database and a koha-conf.xml. The solution is to mock all database- and koha-conf-using routines. To test: 1) Stop MySQL 2) Unset KOHA_CONF 3) Run test Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 --- Comment #12 from Jared Camins-Esakov <jcamins@cpbibliography.com> --- Created attachment 13158 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=13158&action=edit Bug 8846 conflict resolution: correct path The test was moved since the original patch was written, making the revised test fail. This patch corrects the mocked template patch so that the test will pass. To test: 1) Before applying patch, run `prove t/db_dependent/SuggestionEngine_ExplodedTerms.t` 2) Note that it fails. 3) Apply patch. 4) Run `prove t/db_dependent/SuggestionEngine_ExplodedTerms.t` 5) Note that it passes. 6) Celebrate. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #13158|0 |1 is obsolete| | --- Comment #13 from Chris Cormack <chris@bigballofwax.co.nz> --- Created attachment 13160 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=13160&action=edit Bug 8846 conflict resolution: correct path The test was moved since the original patch was written, making the revised test fail. This patch corrects the mocked template patch so that the test will pass. To test: 1) Before applying patch, run `prove t/db_dependent/SuggestionEngine_ExplodedTerms.t` 2) Note that it fails. 3) Apply patch. 4) Run `prove t/db_dependent/SuggestionEngine_ExplodedTerms.t` 5) Note that it passes. 6) Celebrate. 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=8846 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |ASSIGNED CC| |chris@bigballofwax.co.nz -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 Chris Cormack <chris@bigballofwax.co.nz> 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=8846 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off --- Comment #14 from Chris Cormack <chris@bigballofwax.co.nz> --- The test fails unless BOTH patches are pushed, I have signed off the second one, putting it back to signed off for QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 Mason James <mtj@kohaaloha.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA CC| |mtj@kohaaloha.com --- Comment #15 from Mason James <mtj@kohaaloha.com> --- (In reply to comment #14)
The test fails unless BOTH patches are pushed, I have signed off the second one, putting it back to signed off for QA
test works as stated - passing QA on 2 patches... (awesome stuff Jared) $ sudo /etc/init.d/mysql stop $ export KOHA_CONF='' $ perl t/db_dependent/SuggestionEngine_ExplodedTerms.t ok 1 - use Koha::SuggestionEngine; unable to locate Koha configuration file koha-conf.xml at /home/mason/git/head/C4/Context.pm line 360. unable to locate Koha configuration file koha-conf.xml at /home/mason/git/head/C4/Context.pm line 360. Use of uninitialized value in concatenation (.) or string at /home/mason/git/head/C4/Templates.pm line 208. ok 2 - Created suggestion engine ok 3 - Suggested correct alternatives for keyword search 'Cookery' ok 4 - Suggested correct alternatives for subject search 'Cookery' ok 5 - No suggestions for fielded search ok 6 - No suggestions for CCL search 1..6 $ koha-qa.pl -c 2 -v 2 testing 2 commit(s) (applied to commit ea9e867) * a9729fd Bug 8846 conflict resolution: correct path t/db_dependent/SuggestionEngine_ExplodedTerms.t * 3207eb3 Bug 8846: Exploded Terms test sneakily uses database t/db_dependent/SuggestionEngine_ExplodedTerms.t * t/db_dependent/SuggestionEngine_ExplodedTerms.t OK pod OK forbidden patterns OK valid OK critic OK -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|master |rel_3_10 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #16 from Jared Camins-Esakov <jcamins@cpbibliography.com> --- This patch has been pushed to master and is suitable for backporting to 3.10. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #13160|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=8846 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #13157|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=8846 --- Comment #17 from Paul Poulain <paul.poulain@biblibre.com> --- Patch pushed to branch 3.10.x -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8846 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |RESOLVED Resolution|--- |FIXED --- Comment #18 from Chris Cormack <chris@bigballofwax.co.nz> --- Released in 3.10.0 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org