Summary: | Fix failures for Database/Commenter.t on MySQL 8 | ||
---|---|---|---|
Product: | Koha | Reporter: | Marcel de Rooy <m.de.rooy> |
Component: | Test Suite | Assignee: | Marcel de Rooy <m.de.rooy> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | normal | ||
Priority: | P5 - low | CC: | david, martin.renvoize, tomascohen |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | Small patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
23.05.00
|
|
Circulation function: | |||
Bug Depends on: | 32334 | ||
Bug Blocks: | |||
Attachments: |
Bug 33584: Fix failures for Commenter.t on MySQL8
Bug 33584: (follow-up) Remove DEFAULT_GENERATED from column info Bug 33584: Fix failures for Commenter.t on MySQL8 Bug 33584: (follow-up) Remove DEFAULT_GENERATED from column info Bug 33584: Fix failures for Commenter.t on MySQL8 Bug 33584: (follow-up) Remove DEFAULT_GENERATED from column info Bug 33612: Fix cat-search.inc and remove home-search.inc |
Description
Marcel de Rooy
2023-04-21 15:28:37 UTC
Failures second subtest should be related to problem in first: # Subtest: ->clear, ->reset, ->renumber 1..6 not ok 1 - Found no comment for sometext not ok 2 - Found no comment for anotherint ok 3 - Found comment for sometext ok 4 - Found comment for anotherint not ok 5 - Found Column_1 not ok 6 - Found Column_5 not ok 2 - ->clear, ->reset, ->renumber Created attachment 150068 [details] [review] Bug 33584: Fix failures for Commenter.t on MySQL8 The column names from information_schema are uppercase now in MySQL8. In the arrayref with sliced hashes, we expected lowercase. See e.g. https://stackoverflow.com/questions/54538448/what-are-the-changes-in-mysql-8-result-rowset-case Test plan: Run t/db_dependent/Koha/Database/Commenter.t Do it again if possible with a MySQL 8 db server. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Tomas: Could you please try to run the test with Mysql 8 ? Or just push and see :) (In reply to Marcel de Rooy from comment #0) > Looks like we are reading info from another database or so, here: > > SELECT table_name, column_name, column_comment FROM > information_schema.columns > WHERE table_schema=? AND table_name=? > ORDER BY table_name, column_name|; > > Or perhaps no permissions ? It is always simpler: I got uppercase in my hash keys instead of lower case. I tested using KTD (changed database in .env file from DB_IMAGE=mariadb:10.5 to DB_IMAGE=mysql:8). I also tested using the default database (mariadb:10.5) - the tests pass before and after the patch is applied. Before patch applied (MySQL 8) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Before the patch was applied, I got these results: prove t/db_dependent/Koha/Database/Commenter.t t/db_dependent/Koha/Database/Commenter.t .. # Failed test 'No comment for toc_request' # at t/db_dependent/Koha/Database/Commenter.t line 34. # got: '0' # expected: '1' Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. # Failed test 'Numbered comment for toc_request' # at t/db_dependent/Koha/Database/Commenter.t line 39. # got: '0' # expected: '1' # Failed test 'Reset for one-columned article_requests' # at t/db_dependent/Koha/Database/Commenter.t line 49. # 'ALTER TABLE koha_kohadev.article_requests MODIFY COLUMN `toc_request` tinyint NOT NULL DEFAULT 0 COMMENT 'borrower requested table of contents';' # doesn't match '(?^um:ALTER.*toc_request.*DEFAULT 0;(.*\n)+ALTER.*toc_request.*COMMENT.*$)' # Looks like you failed 3 tests of 6. t/db_dependent/Koha/Database/Commenter.t .. 1/2 # Failed test '->new, dry_run' # at t/db_dependent/Koha/Database/Commenter.t line 52. # Failed test 'Found no comment for sometext' # at t/db_dependent/Koha/Database/Commenter.t line 61. # got: 'some nice quote's' # expected: '' # Failed test 'Found no comment for anotherint' # at t/db_dependent/Koha/Database/Commenter.t line 62. # got: 'my int' # expected: '' Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. Use of uninitialized value in string ne at /kohadevbox/koha/Koha/Database/Commenter.pm line 147. # Failed test 'Found Column_1' # at t/db_dependent/Koha/Database/Commenter.t line 73. # got: 'my int' # expected: 'Column_1' # Failed test 'Found Column_5' # at t/db_dependent/Koha/Database/Commenter.t line 74. # got: '' # expected: 'Column_5' # Looks like you failed 4 tests of 6. # Failed test '->clear, ->reset, ->renumber' # at t/db_dependent/Koha/Database/Commenter.t line 78. # Looks like you failed 2 tests of 2. t/db_dependent/Koha/Database/Commenter.t .. Dubious, test returned 2 (wstat 512, 0x200) Failed 2/2 subtests Test Summary Report ------------------- t/db_dependent/Koha/Database/Commenter.t (Wstat: 512 Tests: 2 Failed: 2) Failed tests: 1-2 Non-zero exit status: 2 Files=1, Tests=2, 1 wallclock secs ( 0.01 usr 0.00 sys + 0.50 cusr 0.03 csys = 0.54 CPU) Result: FAIL After the patch was applied (MySQL 8) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ After the patch was applied, I got these results: prove t/db_dependent/Koha/Database/Commenter.t t/db_dependent/Koha/Database/Commenter.t .. 1/2 Failure for database_commenter_1:timestamp2 at /kohadevbox/koha/Koha/Database/Commenter.pm line 266. # Failed test 'Found Column_5' # at t/db_dependent/Koha/Database/Commenter.t line 80. # got: '' # expected: 'Column_5' # Looks like you failed 1 test of 6. # Failed test '->clear, ->reset, ->renumber' # at t/db_dependent/Koha/Database/Commenter.t line 84. # Looks like you failed 1 test of 2. t/db_dependent/Koha/Database/Commenter.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/2 subtests Test Summary Report ------------------- t/db_dependent/Koha/Database/Commenter.t (Wstat: 256 Tests: 2 Failed: 1) Failed test: 2 Non-zero exit status: 1 Files=1, Tests=2, 1 wallclock secs ( 0.02 usr 0.00 sys + 0.50 cusr 0.06 csys = 0.58 CPU) Result: FAIL Created attachment 150154 [details] [review] Bug 33584: (follow-up) Remove DEFAULT_GENERATED from column info MySQL 8 returns this additional information for a timestamp such as the timestamp2 in the Commenter test. Which results in the following alter: ALTER TABLE koha_myclone.database_commenter_1 MODIFY COLUMN `timestamp2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP DEFAULT_GENERATED COMMENT 'Column_5' And that statement fails again on that keyword. For now, it seems sufficient to ignore this keyword when building the alter statement. Test plan: Run t/db_dependent/Koha/Database/Commenter.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Did test it now under MySQL 8. (In reply to Marcel de Rooy from comment #3) > Tomas: Could you please try to run the test with Mysql 8 ? Or just push and > see :) Tested it now with a Mysql 8 container myself :) I tested with: $ DB_IMAGE=mysql:8 ktd up -d $ ktd --shell $ prove t/db_dependent/Koha/Database/Commenter.t and $ ktd down $ DB_IMAGE=mariadb:10.5 ktd up -d $ ktd --shell $ prove t/db_dependent/Koha/Database/Commenter.t In both cases it run fine. Created attachment 150159 [details] [review] Bug 33584: Fix failures for Commenter.t on MySQL8 The column names from information_schema are uppercase now in MySQL8. In the arrayref with sliced hashes, we expected lowercase. See e.g. https://stackoverflow.com/questions/54538448/what-are-the-changes-in-mysql-8-result-rowset-case Test plan: Run t/db_dependent/Koha/Database/Commenter.t Do it again if possible with a MySQL 8 db server. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Created attachment 150160 [details] [review] Bug 33584: (follow-up) Remove DEFAULT_GENERATED from column info MySQL 8 returns this additional information for a timestamp such as the timestamp2 in the Commenter test. Which results in the following alter: ALTER TABLE koha_myclone.database_commenter_1 MODIFY COLUMN `timestamp2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP DEFAULT_GENERATED COMMENT 'Column_5' And that statement fails again on that keyword. For now, it seems sufficient to ignore this keyword when building the alter statement. Test plan: Run t/db_dependent/Koha/Database/Commenter.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Did test it now under MySQL 8. Created attachment 150161 [details] [review] Bug 33584: Fix failures for Commenter.t on MySQL8 The column names from information_schema are uppercase now in MySQL8. In the arrayref with sliced hashes, we expected lowercase. See e.g. https://stackoverflow.com/questions/54538448/what-are-the-changes-in-mysql-8-result-rowset-case Test plan: Run t/db_dependent/Koha/Database/Commenter.t Do it again if possible with a MySQL 8 db server. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Created attachment 150162 [details] [review] Bug 33584: (follow-up) Remove DEFAULT_GENERATED from column info MySQL 8 returns this additional information for a timestamp such as the timestamp2 in the Commenter test. Which results in the following alter: ALTER TABLE koha_myclone.database_commenter_1 MODIFY COLUMN `timestamp2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP DEFAULT_GENERATED COMMENT 'Column_5' And that statement fails again on that keyword. For now, it seems sufficient to ignore this keyword when building the alter statement. Test plan: Run t/db_dependent/Koha/Database/Commenter.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Did test it now under MySQL 8. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Pushed to master for 23.05. Nice work everyone, thanks! Created attachment 150224 [details] [review] Bug 33612: Fix cat-search.inc and remove home-search.inc To test: 1. Setup a staff member with staff access permission but no circulate permissions. 2. Log in as that and on the intranet-home page notice that 'Search patron' bar across the top is not visible by default. 3. Click the 'Search patrons' link at the top, now you see the search bar. 4. This is also true on the item search page. 5. Apply patch 6. Try looking at the intranet home and item search pages again, the search bar should be expanded by default. 7. git grep 'home-search.inc' , this include should be gone along with all references to it. 8. Log in as a superlibrarian and make sure the top search bars still seem correct and default to the correct ones. Comment on attachment 150224 [details] [review] Bug 33612: Fix cat-search.inc and remove home-search.inc Obsoleting - patch attached to the wrong bug. Bugfix to enhancement not in 22.11.x. Marking as resolved. |