From 7cf3f2d156877b9d0c406ff5a6fce9424addca15 Mon Sep 17 00:00:00 2001 From: Israel Fruchter Date: Tue, 10 Sep 2024 16:45:59 +0300 Subject: [PATCH] fix(get_all_versions_from_centos_repository): limit only to scylla packages since now scylla-doctor was introduced into scylla repositories we don't want to retrive it's version, only the scylla versions if and when we'll need to get it's version, we'll need to refactor this code to supply list of package we'll want to look at. --- sdcm/utils/version_utils.py | 5 ++++- unit_tests/test_base_version.py | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sdcm/utils/version_utils.py b/sdcm/utils/version_utils.py index aee3b75fa6..5bcdda3a8a 100644 --- a/sdcm/utils/version_utils.py +++ b/sdcm/utils/version_utils.py @@ -92,6 +92,8 @@ LATEST_SYMLINK_NAME = "latest" NO_TIMESTAMP = dateutil.parser.parse("1961-04-12T06:07:00Z", ignoretz=True) # Poyekhali! +SUPPORTED_PACKAGES = ("scylla", "scylla-enterprise", "scylla-manager") + LOGGER = logging.getLogger(__name__) @@ -359,7 +361,8 @@ def get_version(url: str) -> set[str]: xml_url = url.replace(REPOMD_XML_PATH, primary_path) parser = Parser(url=xml_url) - major_versions = [package['version'][1]['ver'] for package in parser.getList()] + major_versions = [package['version'][1]['ver'] + for package in parser.getList() if package['name'][0] in SUPPORTED_PACKAGES] return set(major_versions) threads = ParallelObject(objects=urls, timeout=SCYLLA_URL_RESPONSE_TIMEOUT).run(func=get_version) diff --git a/unit_tests/test_base_version.py b/unit_tests/test_base_version.py index 9d63e52364..b86032e3c1 100644 --- a/unit_tests/test_base_version.py +++ b/unit_tests/test_base_version.py @@ -128,6 +128,12 @@ def test_2024_2(self): version_list = general_test(scylla_repo, linux_distro) assert set(version_list) == {'6.0', '2024.1'} + def test_2024_2_ubuntu(self): + scylla_repo = self.url_base + '-enterprise/enterprise-2024.2/deb/unified/latest/scylladb-2024.2/scylla.list' + linux_distro = 'ubuntu-focal' + version_list = general_test(scylla_repo, linux_distro) + assert set(version_list) == {'6.0', '2024.1'} + if __name__ == "__main__": unittest.main()