https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42835

--- Comment #59 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 205424
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205424&action=edit
Bug 42835: (QA follow-up) Stop items-index ES calls and SearchEngine pref
leaking out of Item.t

The 'skip biblio re-index for circ-only field changes' subtest mocks
SearchEngine to 'Elasticsearch' via t::lib::Mocks::mock_preference, which
overrides a process-global hash with no automatic restore. It was never
reset back, so every later store() call in the file - including the many
inside the 'Recalls tests' subtest - went on to run with SearchEngine
still set to 'Elasticsearch'.

Koha::Item::store() calls _update_es_index() unconditionally on that
preference, which builds a real Koha::SearchEngine::Elasticsearch::Indexer
and calls index_items()/delete_items() on it. Only index_records() was
mocked on that class, so those calls were free to reach a real (or
unreachable) Elasticsearch cluster from a plain Perl unit test - in the
latter case, the resulting warn() would fail the file's Test::NoWarnings
check.

Mock index_items()/delete_items() as no-ops alongside index_records(), and
restore SearchEngine to 'Zebra' at the end of the subtest, matching the
pattern already used elsewhere (e.g. t/db_dependent/Koha/Authorities.t).

Test plan:
1) Run: prove t/db_dependent/Koha/Item.t

Co-Authored-By: Claude Sonnet 5 <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to