https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44321 --- Comment #6 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 212838 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212838&action=edit Bug 44321: (follow-up) Add t::lib::Wait and wait for the outcome, not a delay The previous patch waits for the import and indexing job rows and then sleeps 2 seconds for Elasticsearch to refresh. Both are proxies: a job row says nothing about the documents being searchable, the sleep is a guess at the refresh interval, a timeout only logged a diag so a stuck queue showed up as a later, misleading failure, and the Zebra path still just slept 10 seconds. Add t::lib::Wait with reusable helpers that poll for the outcome and die with a message saying what was waited for: - wait_until( $description, $condition, $timeout ) - wait_for_job( $job_or_id ): waits for the job to finish, dies straight away if it failed or was cancelled - wait_for_index( \@biblionumbers ): waits until the biblios can be found in the search index of the engine in use. Elasticsearch: refreshes the index and counts the documents by id. Zebra: searches for Local-number Use them in load_records_ui for both search engines instead of the sleeps. Test plan: 1. ktd --search-engine es8 up 2. prove -v t/db_dependent/www/search_utf8.t (KOHA_INTRANET_URL and KOHA_OPAC_URL must be set) 3. Repeat several times, including straight after starting KTD and under load, and with the Elasticsearch indexer slowed down (e.g. pause es_indexer_daemon.pl for 30 seconds after each import) 4. All checks pass every time 5. Set SearchEngine to Zebra (Administration > System preferences) and run the test again: it passes too 6. Stop es_indexer_daemon.pl and run the test with Elasticsearch: it dies after 120 seconds with "Timed out after 120s waiting for ... to be searchable" Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.