From 41851cdb61679833d963a7379780a7635bc6783e Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Wed, 9 Mar 2022 12:10:14 +0100 Subject: [PATCH 1/2] Add retries to `test_github_search` --- test/unit/tool_util/mulled/test_mulled_search.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/unit/tool_util/mulled/test_mulled_search.py b/test/unit/tool_util/mulled/test_mulled_search.py index 1ca8bb67f51..c5a488e3897 100644 --- a/test/unit/tool_util/mulled/test_mulled_search.py +++ b/test/unit/tool_util/mulled/test_mulled_search.py @@ -1,3 +1,5 @@ +import time + import pytest from galaxy.tool_util.deps.mulled.mulled_search import ( @@ -36,9 +38,18 @@ def test_conda_search(): @external_dependency_management def test_github_search(): t = GitHubSearch() + search1 = t.process_json(t.get_json("adsfasdf"), "adsfasdf") - search2 = t.process_json(t.get_json("bioconductor-gosemsim"), "bioconductor-gosemsim") assert search1 == [] + + # The search sometimes returns no results so we retry a couple of times + num_retries = 3 + search2 = t.process_json(t.get_json("bioconductor-gosemsim"), "bioconductor-gosemsim") + while not search2 and num_retries: + num_retries -= 1 + time.sleep(1) # Wait a bit, otherwise, the search may fail because of throttling + search2 = t.process_json(t.get_json("bioconductor-gosemsim"), "bioconductor-gosemsim") + assert search2 for item in search2: assert "bioconductor-gosemsim" in item["path"] From a28c1c2992267f0c32f1dee56f7afd2bccfa0e95 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Wed, 9 Mar 2022 12:29:36 +0100 Subject: [PATCH 2/2] Increase retries --- test/unit/tool_util/mulled/test_mulled_search.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/tool_util/mulled/test_mulled_search.py b/test/unit/tool_util/mulled/test_mulled_search.py index c5a488e3897..20fa721538f 100644 --- a/test/unit/tool_util/mulled/test_mulled_search.py +++ b/test/unit/tool_util/mulled/test_mulled_search.py @@ -43,11 +43,11 @@ def test_github_search(): assert search1 == [] # The search sometimes returns no results so we retry a couple of times - num_retries = 3 + num_retries = 5 search2 = t.process_json(t.get_json("bioconductor-gosemsim"), "bioconductor-gosemsim") while not search2 and num_retries: num_retries -= 1 - time.sleep(1) # Wait a bit, otherwise, the search may fail because of throttling + time.sleep(2) # Wait a bit, otherwise, the search may fail because of throttling search2 = t.process_json(t.get_json("bioconductor-gosemsim"), "bioconductor-gosemsim") assert search2