[Bug 16868] New: Silence error t/db_dependent/Linker_FirstMatch.t
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 Bug ID: 16868 Summary: Silence error t/db_dependent/Linker_FirstMatch.t Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Test Suite Assignee: mtompset@hotmail.com Reporter: mtompset@hotmail.com QA Contact: gmcharlt@gmail.com When the auth_header table has records which exclude 1xx and 2xx tags, the $bibfield doesn't match anything. This in turn sets it to undef, which triggers an error on the next line killing the test. Solution: improve the SQL query so it will find the expected records, or not and properly skip tests. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 --- Comment #1 from M. Tompsett <mtompset@hotmail.com> --- Created attachment 53154 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53154&action=edit auth_header.sql My auth_header which triggered this problem. perhaps a: use koha_library; source auth_header.sql; might be useful for testing. Don't push anywhere! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch 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=16868 --- Comment #2 from M. Tompsett <mtompset@hotmail.com> --- Created attachment 53155 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53155&action=edit Bug 16868: Silence error t/db_dependent/Linker_FirstMatch.t When the auth_header table has records which exclude 1xx and 2xx tags, the $bibfield doesn't match anything. This in turn sets it to undef, which triggers an error on the next line killing the test. LIMIT was removed as it is not necessary and is a MySQL-ism. Though this may slow down testing with huge auth_header files, it should not be significant. TEST PLAN --------- 1) back up DB 2) Make sure to add in some authority records. 3) DELETE FROM auth_header WHERE marcxml LIKE '%datafield tag="1%'; DELETE FROM auth_header WHERE marcxml LIKE '%datafield tag="2%'; -- Now the test should blow up nicely. -- If you find you have no records, add more such that you repeat steps 2 and 3 and still have records in auth_header. Sorry, getting the trigger data is the hard part. 4) prove t/db_dependent/Linker_FirstMatch.t -- should barf before running all the tests 5) apply patch 6) prove t/db_dependent/Linker_FirstMatch.t -- should have pretty skip message(s) 7) run koha qa test tools 8) restore your backup -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |minor -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 Marc Véron <veron@veron.ch> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #53155|0 |1 is obsolete| | --- Comment #3 from Marc Véron <veron@veron.ch> --- Created attachment 53411 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53411&action=edit Bug 16868: Silence error t/db_dependent/Linker_FirstMatch.t When the auth_header table has records which exclude 1xx and 2xx tags, the $bibfield doesn't match anything. This in turn sets it to undef, which triggers an error on the next line killing the test. LIMIT was removed as it is not necessary and is a MySQL-ism. Though this may slow down testing with huge auth_header files, it should not be significant. TEST PLAN --------- 1) back up DB 2) Make sure to add in some authority records. 3) DELETE FROM auth_header WHERE marcxml LIKE '%datafield tag="1%'; DELETE FROM auth_header WHERE marcxml LIKE '%datafield tag="2%'; -- Now the test should blow up nicely. -- If you find you have no records, add more such that you repeat steps 2 and 3 and still have records in auth_header. Sorry, getting the trigger data is the hard part. 4) prove t/db_dependent/Linker_FirstMatch.t -- should barf before running all the tests 5) apply patch 6) prove t/db_dependent/Linker_FirstMatch.t -- should have pretty skip message(s) 7) run koha qa test tools 8) restore your backup Signed-off-by: Marc Véron <veron@veron.ch> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 Marc Véron <veron@veron.ch> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |veron@veron.ch 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=16868 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |In Discussion CC| |jonathan.druart@bugs.koha-c | |ommunity.org --- Comment #4 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Instead of trying to fix specific case, I'd suggest to insert the data you want to make the tests pass: - Start transaction - Create the authority you want - Retrieve the authority and use it for the tests. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 --- Comment #5 from M. Tompsett <mtompset@hotmail.com> --- (In reply to Jonathan Druart from comment #4)
Instead of trying to fix specific case, I'd suggest to insert the data you want to make the tests pass: - Start transaction - Create the authority you want - Retrieve the authority and use it for the tests.
Okay, I'll refactor to use t::lib::Database (your code from bug 14334) and t::lib::TestBuilder. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 --- Comment #6 from M. Tompsett <mtompset@hotmail.com> --- Created attachment 53451 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53451&action=edit Bug 16868: Jonathan Druart testing dbh code I grabbed the code from bug 14334, and will use it here. prove t/db_dependent/Linker_FirstMatch.t will demonstrate it works. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|In Discussion |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #53411|0 |1 is obsolete| | --- Comment #7 from M. Tompsett <mtompset@hotmail.com> --- Created attachment 53452 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53452&action=edit Bug 16868: Silence error t/db_dependent/Linker_FirstMatch.t When the auth_header table has records which exclude 1xx and 2xx tags, the $bibfield doesn't match anything. This in turn sets it to undef, which triggers an error on the next line killing the test. This was completely refactored to provide the data necessary for the tests to pass, and to be more comprehensive (both MARC and UNIMARC are tested). The tests are then run. TEST PLAN --------- 1) back up DB 2) DELETE FROM auth_header; 3) SOURCE auth_header.sql; -- the provided file 4) prove t/db_dependent/Linker_FirstMatch.t -- should barf before running all the tests 5) apply all patches 6) prove t/db_dependent/Linker_FirstMatch.t -- should work happy 7) run koha qa test tools 8) restore your backup -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #53451|0 |1 is obsolete| | --- Comment #8 from M. Tompsett <mtompset@hotmail.com> --- Created attachment 53453 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53453&action=edit Bug 16868: Jonathan Druart testing dbh code I grabbed the code from bug 14334, and will use it here. prove t/db_dependent/Linker_FirstMatch.t will demonstrate it works. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #53452|0 |1 is obsolete| | --- Comment #9 from M. Tompsett <mtompset@hotmail.com> --- Created attachment 53454 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53454&action=edit Bug 16868: Silence error t/db_dependent/Linker_FirstMatch.t When the auth_header table has records which exclude 1xx and 2xx tags, the $bibfield doesn't match anything. This in turn sets it to undef, which triggers an error on the next line killing the test. This was completely refactored to provide the data necessary for the tests to pass, and to be more comprehensive (both MARC and UNIMARC are tested). The tests are then run. TEST PLAN --------- 1) back up DB 2) DELETE FROM auth_header; 3) SOURCE auth_header.sql; -- the provided file 4) prove t/db_dependent/Linker_FirstMatch.t -- should barf before running all the tests 5) apply all patches 6) prove t/db_dependent/Linker_FirstMatch.t -- should work happy 7) run koha qa test tools 8) restore your backup -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 --- Comment #10 from M. Tompsett <mtompset@hotmail.com> --- Comment on attachment 53454 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53454 Bug 16868: Silence error t/db_dependent/Linker_FirstMatch.t Review of attachment 53454: --> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=16868&attachment=53454) ----------------------------------------------------------------- ::: t/db_dependent/Linker_FirstMatch.t @@ -36,3 @@
my $tag = $bibfield->tag(); - $tag =~ s/^./6/; - $bibfield->update(tag => $tag);
For the record, this code never worked. It doesn't change the tag, it adds a subfield called tag. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #53454|0 |1 is obsolete| | --- Comment #11 from M. Tompsett <mtompset@hotmail.com> --- Created attachment 53455 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53455&action=edit Bug 16868: Silence error t/db_dependent/Linker_FirstMatch.t When the auth_header table has records which exclude 1xx and 2xx tags, the $bibfield doesn't match anything. This in turn sets it to undef, which triggers an error on the next line killing the test. This was completely refactored to provide the data necessary for the tests to pass, and to be more comprehensive (both MARC and UNIMARC are tested). The tests are then run. TEST PLAN --------- 1) back up DB 2) DELETE FROM auth_header; 3) SOURCE auth_header.sql; -- the provided file 4) prove t/db_dependent/Linker_FirstMatch.t -- should barf before running all the tests 5) apply all patches 6) prove t/db_dependent/Linker_FirstMatch.t -- should work happy 7) run koha qa test tools 8) restore your backup -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com Status|Needs Signoff |Failed QA --- Comment #12 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Mark, could you please do something like this instead? (grabbed from some other test and adjusted to your use). sub get_authtority_record { my $main_heading_field = ( C4::Context->preference('MARCFlavour') eq 'UNIMARC' ) ? '200' : '100'; my $auth = MARC::Record->new(); $auth->append_fields( MARC::Field->new($main_heading_field, ' ', ' ', a => 'Geisel, Theodor Seuss,', d => '1904-1991' )); return $auth; } It seems to me that the interpolated XML stuff obfuscates the code, and does unneeded XML processing. Also, the global transaction for tests was discouraged so no need to introduce Database.pm for this simple test as we just do the transaction as it is needed in the tests (think of subtests that do its own rollbacks, etc). So go for the usual: use Koha::Database; my $schema = Koha::Database->new->schema; $schema->storage->txn_begin; < tests here > $schema->storage->txn_rollback; BTW, it seems to me that this tests don't bother to launch zebra so they... don't... actually... test anything? Good examples on how to do this can be found (for C&P) on search_utf8.t <- This is not your fault and not really part of your bug report, but worth mentioning. The relevant test, is the last one, and it depends on zebra having the record indexed!! Notice C4::Headings::authorities() is calling _search() which actually triggers a Zebra search. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 --- Comment #13 from M. Tompsett <mtompset@hotmail.com> --- (In reply to Tomás Cohen Arazi from comment #12)
Mark, could you please do something like ... [SNIP]
Okay... I'll adjust based on your feedback. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #53453|0 |1 is obsolete| | Attachment #53455|0 |1 is obsolete| | --- Comment #14 from M. Tompsett <mtompset@hotmail.com> --- Created attachment 53549 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53549&action=edit Bug 16868: Silence error t/db_dependent/Linker_FirstMatch.t When the auth_header table has records which exclude 1xx and 2xx tags, the $bibfield doesn't match anything. This in turn sets it to undef, which triggers an error on the next line killing the test. This was completely refactored to provide the data necessary for the tests to pass, and to be more comprehensive (both MARC and UNIMARC are tested). The tests are then run. C4::Headings::authorities is mocked, so that this test is not dependent on a search engine. TEST PLAN --------- 1) back up DB 2) DELETE FROM auth_header; 3) SOURCE auth_header.sql; -- the provided file 4) prove t/db_dependent/Linker_FirstMatch.t -- should barf before running all the tests 5) apply all patches 6) prove t/db_dependent/Linker_FirstMatch.t -- should work happy 7) run koha qa test tools 8) restore your backup -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|gmcharlt@gmail.com |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 Marc Véron <veron@veron.ch> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #53549|0 |1 is obsolete| | --- Comment #15 from Marc Véron <veron@veron.ch> --- Created attachment 53729 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53729&action=edit Bug 16868: Silence error t/db_dependent/Linker_FirstMatch.t When the auth_header table has records which exclude 1xx and 2xx tags, the $bibfield doesn't match anything. This in turn sets it to undef, which triggers an error on the next line killing the test. This was completely refactored to provide the data necessary for the tests to pass, and to be more comprehensive (both MARC and UNIMARC are tested). The tests are then run. C4::Headings::authorities is mocked, so that this test is not dependent on a search engine. TEST PLAN --------- 1) back up DB 2) DELETE FROM auth_header; 3) SOURCE auth_header.sql; -- the provided file 4) prove t/db_dependent/Linker_FirstMatch.t -- should barf before running all the tests 5) apply all patches 6) prove t/db_dependent/Linker_FirstMatch.t -- should work happy 7) run koha qa test tools 8) restore your backup Followed test plan, behaves as expected. Signed-off-by: Marc <veron@veron.ch> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 Marc Véron <veron@veron.ch> changed: What |Removed |Added ---------------------------------------------------------------------------- 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=16868 Jonathan Druart <jonathan.druart@bugs.koha-community.org> 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=16868 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #53729|0 |1 is obsolete| | --- Comment #16 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 53880 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53880&action=edit Bug 16868: Silence error t/db_dependent/Linker_FirstMatch.t When the auth_header table has records which exclude 1xx and 2xx tags, the $bibfield doesn't match anything. This in turn sets it to undef, which triggers an error on the next line killing the test. This was completely refactored to provide the data necessary for the tests to pass, and to be more comprehensive (both MARC and UNIMARC are tested). The tests are then run. C4::Headings::authorities is mocked, so that this test is not dependent on a search engine. TEST PLAN --------- 1) back up DB 2) DELETE FROM auth_header; 3) SOURCE auth_header.sql; -- the provided file 4) prove t/db_dependent/Linker_FirstMatch.t -- should barf before running all the tests 5) apply all patches 6) prove t/db_dependent/Linker_FirstMatch.t -- should work happy 7) run koha qa test tools 8) restore your backup Followed test plan, behaves as expected. Signed-off-by: Marc <veron@veron.ch> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 Brendan Gallagher <brendan@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |brendan@bywatersolutions.co | |m Status|Passed QA |Pushed to Master --- Comment #17 from Brendan Gallagher <brendan@bywatersolutions.com> --- Pushed to master. Should be in the November 2016 release. Thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 Frédéric Demians <frederic@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable CC| |frederic@tamil.fr --- Comment #18 from Frédéric Demians <frederic@tamil.fr> --- Pushed in 16.05. Will be in 16.05.03. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16868 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |julian.maurice@biblibre.com Depends on| |16155 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16155 [Bug 16155] Composite keys in TestBuilder and more -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org