[Bug 8649] New: C4::Search needs a unit test
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8649 Priority: P5 - low Change sponsored?: --- Bug ID: 8649 Assignee: jcamins@cpbibliography.com Summary: C4::Search needs a unit test Severity: enhancement Classification: Unclassified OS: All Reporter: jcamins@cpbibliography.com Hardware: All Status: NEW Version: master Component: Test Suite Product: Koha Due to the size of the patch, it seems better to put this test on a separate bug than 5327 where other unit tests for C4 are going. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8649 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://bugs.koha-community. | |org/bugzilla3/show_bug.cgi? | |id=5327 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8649 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=8649 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |8648 --- Comment #1 from Jared Camins-Esakov <jcamins@cpbibliography.com> --- Please sign off the patch in the search_t branch of my GitHub repo: https://github.com/jcamins/koha/tree/search_t I tried to attach the patch but it is too large. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8649 --- Comment #2 from Jared Camins-Esakov <jcamins@cpbibliography.com> --- Created attachment 11642 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11642&action=edit Bug 8649: Add unit test for C4::Search This patch adds a unit test for C4::Search in t/db_dependent. In order to test the functioning of the Zebra search, this patch actually includes an entire Zebra sandbox, and pre-indexed files, which are stored in t/db_dependent/data (the configuration files are generated on the fly). This test depends on Test::Warn, Test::MockModule, and DBD::Mock. To test: 1) Run the test. There should be no failures, and no warnings. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8649 wajasu <matted-34813@mypacks.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #11642|0 |1 is obsolete| | --- Comment #3 from wajasu <matted-34813@mypacks.net> --- Created attachment 11648 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11648&action=edit [SIGNED-OFF] 0002-Bug-8649-Add-unit-test-for-C4-Search.patch -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8649 --- Comment #4 from wajasu <matted-34813@mypacks.net> --- Created attachment 11649 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11649&action=edit [SIGNED-OFF] 0003-bug-8649-make-sure-C4-Context-is-fully-mocked-up-bef.patch -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8649 --- Comment #5 from wajasu <matted-34813@mypacks.net> --- Created attachment 11650 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11650&action=edit [SIGNED-OFF] 0004-bug-8649-make-sure-we-can-exit-if-a-test-fails.patch -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8649 --- Comment #6 from wajasu <matted-34813@mypacks.net> --- Created attachment 11651 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11651&action=edit [SIGNED-OFF] 0005-bug-8649-create-a-temp-directory-for-Zebra-for-C4-Se.patch -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8649 --- Comment #7 from wajasu <matted-34813@mypacks.net> --- Created attachment 11652 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11652&action=edit [SIGNED-OFF] 0006-bug-8649-quiet-a-variable-use-warning.patch For the record, when signing off, jcamins, gmcharlt, and wajasu collabrated for the patches, and it resulted in 5 commits, which preserve the history of work done. Pardon my explicit TODO list: 1) git clone git://git.koha-community.org/koha.git kohaclone ; cd kohaclone 2) git remote add gkohatest https://github.com/gmcharlt/koha-test.git 3) git fetch gkohatest 4) git branch bug8649_signed_off gkohatest/bug8649_signed_off 5) git checkout bug8649_signed_off 6) prove t/db_dependent/Search.t t/db_dependent/Search.t .. ok All tests successful. Files=1, Tests=57, 7 wallclock secs ( 0.02 usr 0.01 sys + 2.37 cusr 0.41 csys = 2.81 CPU) Result: PASS 7) there was much rejoicing 8) commited the last commits in my local test branch pertaining to this bug git commit --amend -s -c fd27241a0c57e696a28966abe4024ce29616660b git commit --amend -s -c 6f379b594363b6703f7b261c0f6c03bd164a70c0 git commit --amend -s -c e1e21badfc45f4b442870d4ebea719836d012b18 git commit --amend -s -c 3719c6c3f61243a058bd34101e7d1cb787ba9713 git commit --amend -s -c 9efbc14cf9eaab554881e189916b5ac2eca8c712 9) git format-patch -s origin/master and sent patches to mailing list 10) attached them to bugzilla Note: 0002-0006 ( a total of 5 patches ) is what is required Congrats to jcamins on the excellent test for zebra Search and to gmcharlt on supportive patches which runs without a hitch in my koha test VM, over a sshfs mounted kohaclone. :) wajasu -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8649 wajasu <matted-34813@mypacks.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off CC| |matted-34813@mypacks.net -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8649 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #11648|0 |1 is obsolete| | --- Comment #8 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 11925 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11925&action=edit Bug 8649: Add unit test for C4::Search This patch adds a unit test for C4::Search in t/db_dependent. In order to test the functioning of the Zebra search, this patch actually includes an entire Zebra sandbox, and pre-indexed files, which are stored in t/db_dependent/data (the configuration files are generated on the fly). This test depends on Test::Warn, Test::MockModule, and DBD::Mock. To test: 1) Run the test. There should be no failures, and no warnings. Signed-off-by: Galen Charlton <gmc@esilibrary.com> Signed-off-by: wajasu <matted-34813@mypacks.net> 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=8649 --- Comment #9 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 11926 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11926&action=edit bug 8649: make sure C4::Context is fully mocked-up before tests This fixes failures of the test cases to run for me on Perl 5.10.1 using prove -v t/db_dependent/Search.t Signed-off-by: Galen Charlton <gmc@esilibrary.com> Signed-off-by: wajasu <matted-34813@mypacks.net> 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=8649 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #11925|0 |1 is obsolete| | --- Comment #10 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 11927 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11927&action=edit [SIGNED-OFF] Bug 8649: Add unit test for C4::Search This patch adds a unit test for C4::Search in t/db_dependent. In order to test the functioning of the Zebra search, this patch actually includes an entire Zebra sandbox, and pre-indexed files, which are stored in t/db_dependent/data (the configuration files are generated on the fly). This test depends on Test::Warn, Test::MockModule, and DBD::Mock. To test: 1) Run the test. There should be no failures, and no warnings. Signed-off-by: Galen Charlton <gmc@esilibrary.com> Signed-off-by: wajasu <matted-34813@mypacks.net> 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=8649 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #11926|0 |1 is obsolete| | --- Comment #11 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 11928 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11928&action=edit [SIGNED-OFF] bug 8649: make sure C4::Context is fully mocked-up before tests This fixes failures of the test cases to run for me on Perl 5.10.1 using prove -v t/db_dependent/Search.t Signed-off-by: Galen Charlton <gmc@esilibrary.com> Signed-off-by: wajasu <matted-34813@mypacks.net> 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=8649 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #11649|0 |1 is obsolete| | Attachment #11650|0 |1 is obsolete| | --- Comment #12 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 11929 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11929&action=edit [SIGNED-OFF] bug 8649: make sure we can exit if a test fails Signed-off-by: Galen Charlton <gmc@esilibrary.com> Signed-off-by: wajasu <matted-34813@mypacks.net> 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=8649 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #11929|0 |1 is obsolete| | --- Comment #13 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 11930 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11930&action=edit [SIGNED-OFF] bug 8649: make sure we can exit if a test fails Signed-off-by: Galen Charlton <gmc@esilibrary.com> Signed-off-by: wajasu <matted-34813@mypacks.net> 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=8649 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #11651|0 |1 is obsolete| | --- Comment #14 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 11931 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11931&action=edit [SIGNED-OFF] bug 8649: create a temp directory for Zebra for C4::Search tests The Zebra test uses Unix-domain sockets, which won't work if Koha is being installed or tested from an NFS- or SSHFS-mounted clone. Therefore, create (and clenaup) a temporary directory on (hopefully) a normal filesytem to run the test. Signed-off-by: Galen Charlton <gmc@esilibrary.com> Signed-off-by: wajasu <matted-34813@mypacks.net> 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=8649 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #11652|0 |1 is obsolete| | --- Comment #15 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 11932 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11932&action=edit [SIGNED-OFF] bug 8649: quiet a variable use warning Signed-off-by: Galen Charlton <gmc@esilibrary.com> Signed-off-by: wajasu <matted-34813@mypacks.net> 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=8649 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |8211 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8649 Mason James <mtj@kohaaloha.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA CC| |mtj@kohaaloha.com --- Comment #16 from Mason James <mtj@kohaaloha.com> --- (In reply to comment #15)
Created attachment 11932 [details] [SIGNED-OFF] bug 8649: quiet a variable use warning
Signed-off-by: Galen Charlton <gmc@esilibrary.com> Signed-off-by: wajasu <matted-34813@mypacks.net> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
passing QA on this.. very nice work! $ koha-qa.pl -c 5 testing 5 commit(s) (applied to commit c8ef17e) * b085f62 bug 8649: quiet a variable use warning t/db_dependent/Search.t * b733df4 bug 8649: create a temp directory for Zebra for C4::Search tests t/db_dependent/Search.t t/db_dependent/data/var/lib/zebradb/authorities/key/README t/db_dependent/data/var/lib/zebradb/authorities/register/README t/db_dependent/data/var/lib/zebradb/authorities/shadow/README t/db_dependent/data/var/lib/zebradb/authorities/tmp/README t/db_dependent/data/var/lib/zebradb/biblios/key/README t/db_dependent/data/var/lib/zebradb/biblios/register/README t/db_dependent/data/var/lib/zebradb/biblios/shadow/README t/db_dependent/data/var/lib/zebradb/biblios/tmp/README t/db_dependent/data/var/lock/zebradb/authorities/README t/db_dependent/data/var/lock/zebradb/biblios/README t/db_dependent/data/var/log/README t/db_dependent/data/var/run/zebradb/README t/db_dependent/zebra_config.pl * bbfd59a bug 8649: make sure we can exit if a test fails t/db_dependent/Search.t * 2c46ed7 bug 8649: make sure C4::Context is fully mocked-up before tests t/db_dependent/Search.t * 3568a1f Bug 8649: Add unit test for C4::Search C4/Installer/PerlDependencies.pm t/db_dependent/Search.t t/db_dependent/data/var/lib/zebradb/authorities/key/README t/db_dependent/data/var/lib/zebradb/authorities/register/README t/db_dependent/data/var/lib/zebradb/authorities/shadow/README t/db_dependent/data/var/lib/zebradb/authorities/tmp/README t/db_dependent/data/var/lib/zebradb/biblios/key/README t/db_dependent/data/var/lib/zebradb/biblios/register/README t/db_dependent/data/var/lib/zebradb/biblios/shadow/README t/db_dependent/data/var/lib/zebradb/biblios/tmp/README t/db_dependent/data/var/lock/zebradb/authorities/README t/db_dependent/data/var/lock/zebradb/biblios/README t/db_dependent/data/var/log/README t/db_dependent/data/var/run/zebradb/README t/db_dependent/data/zebraexport/authority/exported_records t/db_dependent/data/zebraexport/biblio/exported_records t/db_dependent/zebra_config.pl * t/db_dependent/Search.t OK * t/db_dependent/zebra_config.pl OK * C4/Installer/PerlDependencies.pm OK -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8649 --- Comment #17 from Mason James <mtj@kohaaloha.com> ---
passing QA on this.. very nice work!
test completes with PASS, as expected... ;) $ prove t/db_dependent/Search.t t/db_dependent/Search.t .. ok All tests successful. Files=1, Tests=57, 4 wallclock secs ( 0.02 usr 0.01 sys + 2.20 cusr 0.63 csys = 2.86 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=8649 Paul Poulain <paul.poulain@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |paul.poulain@biblibre.com Version|master |rel_3_10 --- Comment #18 from Paul Poulain <paul.poulain@biblibre.com> --- Patch pushed to master great job ! question = are those tests really db_dependent ? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8649 --- Comment #19 from Jared Camins-Esakov <jcamins@cpbibliography.com> --- (In reply to comment #18)
Patch pushed to master
great job !
question = are those tests really db_dependent ?
Unfortunately, yes. You don't need any data in your database, but you do have to have a database. One of the BEGIN blocks in one of the modules that C4::Search includes. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8649 Jared Camins-Esakov <jcamins@cpbibliography.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |RESOLVED Resolution|--- |FIXED --- Comment #20 from Jared Camins-Esakov <jcamins@cpbibliography.com> --- C4::Search now has a unit test. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org