This is an automated email from the ASF dual-hosted git repository.
janhoy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-orbit.git
The following commit(s) were added to refs/heads/main by this push:
new 5f3ece03 Fix flaky test worker_coordinator_test.py (#63)
5f3ece03 is described below
commit 5f3ece032111893e3278fdb8a2710ff8d9c3c02e
Author: Jan Høydahl <[email protected]>
AuthorDate: Fri Jul 31 12:44:07 2026 +0200
Fix flaky test worker_coordinator_test.py (#63)
---
solrorbit/workload/workload.py | 3 ++-
tests/worker_coordinator/worker_coordinator_test.py | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/solrorbit/workload/workload.py b/solrorbit/workload/workload.py
index 05fab3ff..af75004c 100644
--- a/solrorbit/workload/workload.py
+++ b/solrorbit/workload/workload.py
@@ -283,7 +283,8 @@ class DocumentCorpus:
return self
else:
return DocumentCorpus(name=self.name,
-
documents=list(set(self.documents).union(other.documents)),
+ # sort by repr so the result is
deterministic regardless of hash randomization
+
documents=sorted(set(self.documents).union(other.documents), key=repr),
streaming_ingestion=self.streaming_ingestion,
meta_data=dict(self.meta_data))
diff --git a/tests/worker_coordinator/worker_coordinator_test.py
b/tests/worker_coordinator/worker_coordinator_test.py
index b5108899..2ee7a4b8 100644
--- a/tests/worker_coordinator/worker_coordinator_test.py
+++ b/tests/worker_coordinator/worker_coordinator_test.py
@@ -1978,7 +1978,7 @@ class AsyncExecutorHelperMethodsTests(TestCase):
self.executor._prepare_context_manager =
mock.AsyncMock(return_value=context_manager)
self.executor.runner = mock.Mock()
- with
mock.patch('solrorbit.worker_coordinator.worker_coordinator.execute_single'):
+ with
mock.patch('solrorbit.worker_coordinator.worker_coordinator.execute_single',
new=mock.Mock()):
with mock.patch('asyncio.wait_for') as wait_for_mock:
wait_for_mock.return_value = (100, "docs", {"success": True})
@@ -2010,7 +2010,8 @@ class AsyncExecutorHelperMethodsTests(TestCase):
self.executor._prepare_context_manager =
mock.AsyncMock(return_value=context_manager)
self.executor.runner = mock.Mock()
- with mock.patch('time.perf_counter', side_effect=[10.0, 10.5, 13.0]):
+ with
mock.patch('solrorbit.worker_coordinator.worker_coordinator.execute_single',
new=mock.Mock()), \
+ mock.patch('time.perf_counter', side_effect=[10.0, 10.5,
13.0]):
with mock.patch('asyncio.sleep') as sleep_mock:
with mock.patch('asyncio.wait_for') as wait_for_mock:
wait_for_mock.return_value = (50, "docs", {"success":
True})