[Bug 26143] New: Cannot see "all" libraries
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26143 Bug ID: 26143 Summary: Cannot see "all" libraries Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: ASSIGNED Severity: major Priority: P5 - low Component: REST API Assignee: tomascohen@gmail.com Reporter: jonathan.druart@bugs.koha-community.org http://kohadev-intra.mydnsname.org:8081/api/v1/libraries?_page=1&_per_page=-1&_match=contains&_order_by=%2Bme.name [2020-08-05 11:02:43.54213] [6610] [debug] GET "/api/v1/libraries" (c37dcb31) [2020-08-05 11:02:43.54286] [6610] [debug] Routing to controller "Koha::REST::V1::Auth" and action "under" [2020-08-05 11:02:43.55991] [6610] [debug] Routing to controller "Koha::REST::V1::Libraries" and action "list" No method pager found for Koha::Libraries Fewer than one entry per page! at /usr/share/perl5/DBIx/Class/ResultSet.pm line 2542. at /kohadevbox/koha/Koha/REST/Plugin/Objects.pm line 127. [2020-08-05 11:02:43.57390] [6610] [debug] 500 Internal Server Error (0.031753s, 31.493/s) It has been caught by a selenium failure: An element could not be located on the page using the given search parameters: //div[@class="main container-fluid"]//a[contains(@href, "/admin/branches.pl?op=add_form&branchcode=UT_BC")],xpath at /kohadevbox/koha/t/lib/Selenium.pm line 174. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26143 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 107836 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=107836&action=edit Bug 26143: The API is always paginated 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=26143 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 107837 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=107837&action=edit Bug 26143: Regression tests This patch introduces tests for the per_page=-1 handling use case. From now on per_page=-1 means 'all resources'. On writing this I noticed that we always paginate results no matter what, but there was a weird condition under which on pagination headers were sent back to the API consumer. This is highlighted in the precedent patch, which is not the -1 situation this one tries to tackle. Both pagination and searching are broken with per_page=-1, which is a standard, and we actually didn't explicitly set a way to request all resources. To verify this: 1. Apply the previous tests patch and this one 2. Run: $ kshell k$ prove t/Koha/REST/Plugin/Pagination.t \ t/db_dependent/Koha/REST/Plugin/Objects.t => FAIL: Things are damn broken 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=26143 --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 107838 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=107838&action=edit Bug 26143: Make the API handle per_page=-1 This patch introduces handling for per_page=-1 and actually adds a missing feature to the API: being able to request all resources on a route. To test this: 1. Visit the libraries admin page 2. On the table, choose to display 'All' rows => FAIL: it doesn't refresh, the browser console displays a 500 error code and so the logs 3. Apply the tests patches 4. Run: $ kshell k$ prove t/Koha/REST/Plugin/Pagination.t \ t/db_dependent/Koha/REST/Plugin/Objects.t => FAIL: Tests fail loudly 5. Apply this patch 6. Restart plack 7. Repeat 2 => SUCCESS: choosing to display all, works 8. Repeat 4 => SUCCESS: Tests pass now! 9. Sign off :-D 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=26143 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff Summary|Cannot see "all" libraries |The API does not handle | |requesting all resources Version|unspecified |master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26143 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |agustinmoyano@theke.io, | |kyle@bywatersolutions.com, | |martin.renvoize@ptfs-europe | |.com, | |nick@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26143 Jonathan Druart <jonathan.druart@bugs.koha-community.org> 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=26143 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #107836|0 |1 is obsolete| | Attachment #107837|0 |1 is obsolete| | Attachment #107838|0 |1 is obsolete| | --- Comment #4 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 107839 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=107839&action=edit Bug 26143: The API is always paginated Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> 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=26143 --- Comment #5 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 107840 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=107840&action=edit Bug 26143: Regression tests This patch introduces tests for the per_page=-1 handling use case. From now on per_page=-1 means 'all resources'. On writing this I noticed that we always paginate results no matter what, but there was a weird condition under which on pagination headers were sent back to the API consumer. This is highlighted in the precedent patch, which is not the -1 situation this one tries to tackle. Both pagination and searching are broken with per_page=-1, which is a standard, and we actually didn't explicitly set a way to request all resources. To verify this: 1. Apply the previous tests patch and this one 2. Run: $ kshell k$ prove t/Koha/REST/Plugin/Pagination.t \ t/db_dependent/Koha/REST/Plugin/Objects.t => FAIL: Things are damn broken Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> 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=26143 --- Comment #6 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 107841 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=107841&action=edit Bug 26143: Make the API handle per_page=-1 This patch introduces handling for per_page=-1 and actually adds a missing feature to the API: being able to request all resources on a route. To test this: 1. Visit the libraries admin page 2. On the table, choose to display 'All' rows => FAIL: it doesn't refresh, the browser console displays a 500 error code and so the logs 3. Apply the tests patches 4. Run: $ kshell k$ prove t/Koha/REST/Plugin/Pagination.t \ t/db_dependent/Koha/REST/Plugin/Objects.t => FAIL: Tests fail loudly 5. Apply this patch 6. Restart plack 7. Repeat 2 => SUCCESS: choosing to display all, works 8. Repeat 4 => SUCCESS: Tests pass now! 9. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> 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=26143 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=26143 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |20.11.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26143 --- Comment #7 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 20.11, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26143 --- Comment #8 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Got something new on Master_U18 #862, I am still not sure it's directly related to this. 18:47:07 selenium_1 | 09:47:07.478 WARN - Exception: Element not found in the cache - perhaps the page has changed since it was looked up 18:47:07 selenium_1 | For documentation on this error, please visit: http://seleniumhq.org/exceptions/stale_element_reference.html 18:47:07 selenium_1 | Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03' 18:47:07 selenium_1 | System info: host: '78b9a07f51f2', ip: '192.168.16.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.0-9-amd64', java.version: '1.8.0_91' 18:47:07 selenium_1 | Driver info: driver.version: unknown 18:47:07 koha_1 | 18:47:07 koha_1 | STRACE: /usr/share/perl5/Try/Tiny.pm:123 in Selenium::Remote::Driver::catch {...} 18:47:07 koha_1 | /usr/local/share/perl/5.26.1/Selenium/Remote/Driver.pm:353 in Try::Tiny::try 18:47:07 koha_1 | (eval 1571):1 in Selenium::Remote::Driver::__ANON__ 18:47:07 koha_1 | (eval 1573):2 in Selenium::Remote::Driver::__ANON__ 18:47:07 koha_1 | (eval 1546):17 in Selenium::Remote::Driver::_execute_command 18:47:07 koha_1 | /usr/local/share/perl/5.26.1/Selenium/Remote/WebElement.pm:63 in Selenium::Remote::WebElement::_execute_command 18:47:07 koha_1 | /kohadevbox/koha/t/lib/Selenium.pm:184 in Selenium::Remote::WebElement::click 18:47:07 koha_1 | /kohadevbox/koha/t/lib/Selenium.pm:172 in t::lib::Selenium::click_when_visible 18:47:07 koha_1 | t/db_dependent/selenium/administration_tasks.t:131 in t::lib::Selenium::click -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26143 --- Comment #9 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Again Master_D11 #57 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26143 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |26162 --- Comment #10 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Opened bug 26162 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26162 [Bug 26162] Prevent Selenium's StaleElementReferenceException -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26143 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |Pushed to stable CC| |lucas@bywatersolutions.com Version(s)|20.11.00 |20.11.00, 20.05.03 released in| | --- Comment #11 from Lucas Gass <lucas@bywatersolutions.com> --- backported to 20.05.x for 20.05.03 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26143 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|20.11.00, 20.05.03 |20.11.00, 20.05.03, released in| |19.11.09 Status|Pushed to stable |Pushed to oldstable CC| |aleisha@catalyst.net.nz --- Comment #12 from Aleisha Amohia <aleisha@catalyst.net.nz> --- backported to 19.11.x for 19.11.09 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26143 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |victor@tuxayo.net --- Comment #13 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Couldn't backport to 19.05.x Conflicts weren't an issue but the last test fails. If there is an interest in having this backported, feel free to submit a patch for 19.05. kohadev-koha@b206c3f13d4a:/kohadevbox/koha$ prove t/Koha/REST/Plugin/Pagination.t t/db_dependent/Koha/REST/Plugin/Objects.t t/Koha/REST/Plugin/Pagination.t ............ ok t/db_dependent/Koha/REST/Plugin/Objects.t .. # Failed test '_per_page=-1 means all resources' # at t/db_dependent/Koha/REST/Plugin/Objects.t line 266. # got: '23' # expected: '24' # Failed test 'When _per_page=-1 the page param is not considered' # at t/db_dependent/Koha/REST/Plugin/Objects.t line 272. # got: '23' # expected: '24' # Looks like you failed 2 tests of 102. t/db_dependent/Koha/REST/Plugin/Objects.t .. 1/2 # Failed test 'objects.search helper' # at t/db_dependent/Koha/REST/Plugin/Objects.t line 275. # Looks like you failed 1 test of 2. t/db_dependent/Koha/REST/Plugin/Objects.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/2 subtests Test Summary Report ------------------- t/db_dependent/Koha/REST/Plugin/Objects.t (Wstat: 256 Tests: 2 Failed: 1) Failed test: 1 Non-zero exit status: 1 Files=2, Tests=4, 4 wallclock secs ( 0.04 usr 0.02 sys + 3.18 cusr 0.41 csys = 3.65 CPU) Result: FAIL -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26143 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |25570 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25570 [Bug 25570] Listing requests should be paginated by default -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org