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

--- Comment #126 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 208131
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208131&action=edit
Bug 42503: (follow-up) Make local_holdgroup_match exclusivity test
deterministic

The "local_holdgroup_match uses exclusivity controls, not LocalHoldsPriority
controls" subtest built its patron with TestBuilder's default (random)
category.
When that category happened to have exclude_from_local_holds_priority = 1, the
LocalHoldsPriority phase in C4::HoldsQueue::MapItemsToHoldRequests was skipped
for the patron:

    next if $patron->category->exclude_from_local_holds_priority;

With LHP skipped, item targeting fell through to the generic allocation path,
which iterates branches/items in Perl hash order and is therefore not
deterministic. In that case the queue could target item_b instead of the
expected item_c, failing the assertion roughly 25-30% of the time.

Build the patron with a category that explicitly has
exclude_from_local_holds_priority = 0 so the LocalHoldsPriority path the
subtest
is meant to exercise always runs.

Note: this only fixes the test. The underlying generic-allocation ordering in
MapItemsToHoldRequests is itself non-deterministic (it iterates
keys %items_by_branch and does not honor StaticHoldsQueueWeight, as the
existing
FIXME in that sub notes). That is a pre-existing issue with a wider blast
radius
and should be addressed separately.

Test plan:
1. Run the test in a loop, e.g.:
     for i in $(seq 1 50); do prove t/db_dependent/HoldsQueue.t || break; done
2. Without this patch it fails intermittently (~25-30% of runs) on
   "LHP correctly targeted the lib_c item".
3. With this patch it passes consistently (50/50).

-- 
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