Skip to content

Commit cabc18b

Browse files
committed
Harden test_index_advanced_filter against pollution from other tests
Use unique_id in all is:published searches to avoid picking up published histories created by other tests running in parallel.
1 parent 1e8572a commit cabc18b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/galaxy_test/api/test_histories.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def test_index_advanced_filter(self):
316316
index_response = self._get("histories", data=data).json()
317317
assert len(index_response) == 3
318318

319-
self._create_history_then_publish_and_archive_it(f"Public Archived history_{uuid4()}")
319+
self._create_history_then_publish_and_archive_it(f"Public Archived history_{unique_id}")
320320
data = dict(search=name_contains, show_published=False)
321321
index_response = self._get("histories", data=data).json()
322322
assert len(index_response) == 3
@@ -327,28 +327,29 @@ def test_index_advanced_filter(self):
327327
assert len(index_response) == 0
328328

329329
# Archived public histories should be included when filtering by show_published and show_archived
330-
data = dict(search="is:published", show_archived=True)
330+
# Use unique_id to filter only histories created by this test
331+
data = dict(search=f"{unique_id} is:published", show_archived=True)
331332
index_response = self._get("histories", data=data).json()
332333
assert len(index_response) == 2
333334

334335
# Searching all published histories will NOT include the archived if show_archived is not set
335-
data = dict(search="is:published")
336+
data = dict(search=f"{unique_id} is:published")
336337
index_response = self._get("histories", data=data).json()
337338
assert len(index_response) == 1
338339

339340
# Searching all published histories will include our own archived when show_own is false
340341
# as long as they are published
341-
data = dict(search="is:published", show_own=False)
342+
data = dict(search=f"{unique_id} is:published", show_own=False)
342343
index_response = self._get("histories", data=data).json()
343344
assert len(index_response) == 2
344345

345346
# Publish a history and archive it by a different user
346347
with self._different_user(f"other_user_{uuid4()}@bx.psu.edu"):
347-
self._create_history_then_publish_and_archive_it(f"Public Archived history_{uuid4()}")
348+
self._create_history_then_publish_and_archive_it(f"Public Archived history_other_{unique_id}")
348349

349350
# Searching all published histories will include archived from other users and our own
350351
# as long as they are published
351-
data = dict(search="is:published", show_own=False)
352+
data = dict(search=f"{unique_id} is:published", show_own=False)
352353
index_response = self._get("histories", data=data).json()
353354
assert len(index_response) == 3
354355

0 commit comments

Comments
 (0)