From 58f767d29618dbb42f51ef5128fe5c9ef2f22746 Mon Sep 17 00:00:00 2001 From: cat-bro Date: Thu, 29 Apr 2021 23:50:12 +1000 Subject: [PATCH 1/4] breaking test for GalaxyInteractorApi get_tool_tests --- lib/galaxy_test/api/test_galaxy_interactor.py | 29 +++++++++++++++++++ .../tools/multiple_versions_v01galaxy6.xml | 21 ++++++++++++++ test/functional/tools/samples_tool_conf.xml | 1 + 3 files changed, 51 insertions(+) create mode 100644 test/functional/tools/multiple_versions_v01galaxy6.xml diff --git a/lib/galaxy_test/api/test_galaxy_interactor.py b/lib/galaxy_test/api/test_galaxy_interactor.py index deee324b556..7d49c358472 100644 --- a/lib/galaxy_test/api/test_galaxy_interactor.py +++ b/lib/galaxy_test/api/test_galaxy_interactor.py @@ -3,6 +3,7 @@ from packaging.version import Version from ._framework import ApiTestCase +from galaxy_test.base.populators import skip_without_tool class GalaxyInteractorBackwardCompatTestCase(ApiTestCase): @@ -11,3 +12,31 @@ class GalaxyInteractorBackwardCompatTestCase(ApiTestCase): self.galaxy_interactor._target_galaxy_version = Version("18.09") assert self.galaxy_interactor.supports_test_data_download is False assert self.galaxy_interactor.test_data_download(tool_id='cat1', filename='1.bed').startswith(b'chr1\t147962192\t147962580') + + +class GalaxyInteractorTestCase(ApiTestCase): + + @skip_without_tool("multiple_versions") + def test_new_version_has_loaded(self): + # this test is redundant, it is just testing that new tool is loaded and the next test will break for the right reasons. I'll remove this + tool_id = "multiple_versions" + tool_version = "0.1+galaxy6" + tool_show_response = self._get("tools/%s" % tool_id, data={'tool_version': tool_version}) + self._assert_status_code_is(tool_show_response, 200) + self.assertEqual(tool_show_response.json().get('version'), tool_version, msg="The new version has not loaded") + + @skip_without_tool("multiple_versions") + def test_get_tool_tests(self): + # test that get_tool_tests will return the right tests when the tool_version has a '+' in it + test_data = self.galaxy_interactor.get_tool_tests(tool_id="multiple_versions", tool_version="0.1+galaxy6") + print(test_data) + assert isinstance(test_data, list) + assert len(test_data) > 0 + assert isinstance(test_data[0], dict) + assert test_data[0].get('tool_version') == "0.1+galaxy6" + + test_data = self.galaxy_interactor.get_tool_tests(tool_id="multiple_versions") # test that tool_version=None does not break it + assert isinstance(test_data, list) + assert len(test_data) > 0 + assert isinstance(test_data[0], dict) + diff --git a/test/functional/tools/multiple_versions_v01galaxy6.xml b/test/functional/tools/multiple_versions_v01galaxy6.xml new file mode 100644 index 00000000000..030b6bc70a9 --- /dev/null +++ b/test/functional/tools/multiple_versions_v01galaxy6.xml @@ -0,0 +1,21 @@ + + + echo "Version 0.1+galaxy6" > $out_file1 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/functional/tools/samples_tool_conf.xml b/test/functional/tools/samples_tool_conf.xml index 0e96f47727e..98d2d67b064 100644 --- a/test/functional/tools/samples_tool_conf.xml +++ b/test/functional/tools/samples_tool_conf.xml @@ -195,6 +195,7 @@ + From 35f341ab830a8d345cf3f5969ba4e8f26e2bb384 Mon Sep 17 00:00:00 2001 From: cat-bro Date: Fri, 30 Apr 2021 00:03:06 +1000 Subject: [PATCH 2/4] linting --- lib/galaxy_test/api/test_galaxy_interactor.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/galaxy_test/api/test_galaxy_interactor.py b/lib/galaxy_test/api/test_galaxy_interactor.py index 7d49c358472..c8c4c62cf53 100644 --- a/lib/galaxy_test/api/test_galaxy_interactor.py +++ b/lib/galaxy_test/api/test_galaxy_interactor.py @@ -2,8 +2,8 @@ from packaging.version import Version -from ._framework import ApiTestCase from galaxy_test.base.populators import skip_without_tool +from ._framework import ApiTestCase class GalaxyInteractorBackwardCompatTestCase(ApiTestCase): @@ -35,8 +35,7 @@ class GalaxyInteractorTestCase(ApiTestCase): assert isinstance(test_data[0], dict) assert test_data[0].get('tool_version') == "0.1+galaxy6" - test_data = self.galaxy_interactor.get_tool_tests(tool_id="multiple_versions") # test that tool_version=None does not break it + test_data = self.galaxy_interactor.get_tool_tests(tool_id="multiple_versions") # test that tool_version=None does not break it assert isinstance(test_data, list) assert len(test_data) > 0 assert isinstance(test_data[0], dict) - From f2ab3f2d026301079d49621318390ea68c2f3f1f Mon Sep 17 00:00:00 2001 From: cat-bro Date: Fri, 30 Apr 2021 00:13:36 +1000 Subject: [PATCH 3/4] update GalaxyInteractorApi.get_tool_tests so that the version is encoded --- lib/galaxy/tool_util/verify/interactor.py | 5 ++--- lib/galaxy_test/api/test_galaxy_interactor.py | 9 --------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/lib/galaxy/tool_util/verify/interactor.py b/lib/galaxy/tool_util/verify/interactor.py index c966460b462..0db67130ff1 100644 --- a/lib/galaxy/tool_util/verify/interactor.py +++ b/lib/galaxy/tool_util/verify/interactor.py @@ -132,9 +132,8 @@ class GalaxyInteractorApi: def get_tool_tests(self, tool_id, tool_version=None): url = "tools/%s/test_data" % tool_id - if tool_version is not None: - url += "?tool_version=%s" % tool_version - response = self._get(url) + params = {'tool_version': tool_version} if tool_version else None + response = self._get(url, data=params) assert response.status_code == 200, "Non 200 response from tool test API. [%s]" % response.content return response.json() diff --git a/lib/galaxy_test/api/test_galaxy_interactor.py b/lib/galaxy_test/api/test_galaxy_interactor.py index c8c4c62cf53..0e3613ce6e4 100644 --- a/lib/galaxy_test/api/test_galaxy_interactor.py +++ b/lib/galaxy_test/api/test_galaxy_interactor.py @@ -16,15 +16,6 @@ class GalaxyInteractorBackwardCompatTestCase(ApiTestCase): class GalaxyInteractorTestCase(ApiTestCase): - @skip_without_tool("multiple_versions") - def test_new_version_has_loaded(self): - # this test is redundant, it is just testing that new tool is loaded and the next test will break for the right reasons. I'll remove this - tool_id = "multiple_versions" - tool_version = "0.1+galaxy6" - tool_show_response = self._get("tools/%s" % tool_id, data={'tool_version': tool_version}) - self._assert_status_code_is(tool_show_response, 200) - self.assertEqual(tool_show_response.json().get('version'), tool_version, msg="The new version has not loaded") - @skip_without_tool("multiple_versions") def test_get_tool_tests(self): # test that get_tool_tests will return the right tests when the tool_version has a '+' in it From 0e88054792b40d22e8eec18b27f8658655262d37 Mon Sep 17 00:00:00 2001 From: cat-bro Date: Fri, 30 Apr 2021 01:57:05 +1000 Subject: [PATCH 4/4] fix other test that fails because of the the extra version of multiple_versions tool --- lib/galaxy_test/api/test_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy_test/api/test_tools.py b/lib/galaxy_test/api/test_tools.py index faa693d9f5e..d6f32b2a4b9 100644 --- a/lib/galaxy_test/api/test_tools.py +++ b/lib/galaxy_test/api/test_tools.py @@ -724,7 +724,7 @@ class ToolsTestCase(ApiTestCase, TestsTools): test_data_response = self._get("tools/%s/test_data?tool_version=*" % "multiple_versions") test_data_response.raise_for_status() test_data_dicts = test_data_response.json() - assert len(test_data_dicts) == 2 + assert len(test_data_dicts) == 3 @skip_without_tool("multiple_versions") @uses_test_history(require_new=False)