From 5ccf78a0ed9ccc71f4b0609514a4122204c5894a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20M=C3=BCller?= Date: Wed, 27 Nov 2024 16:47:11 +0100 Subject: [PATCH] Add testing for the python 3.9 SAC container --- bci_tester/data.py | 87 +++++++++++++++++++++--------------------- pyproject.toml | 1 + tests/test_metadata.py | 17 ++++----- tests/test_python.py | 4 +- 4 files changed, 55 insertions(+), 54 deletions(-) diff --git a/bci_tester/data.py b/bci_tester/data.py index a7d1e97f..1fa82aa6 100755 --- a/bci_tester/data.py +++ b/bci_tester/data.py @@ -253,19 +253,18 @@ class ImageType(enum.Enum): LANGUAGE_STACK = enum.auto() APPLICATION = enum.auto() - SAC_APPLICATION = enum.auto() + SUSE_APPCOLLECTION = enum.auto() OS = enum.auto() OS_LTSS = enum.auto() def __str__(self) -> str: if self.value == ImageType.OS_LTSS: return "suse/ltss" - return ( - "application" - if self.value - in (ImageType.APPLICATION.value, ImageType.SAC_APPLICATION.value) - else "bci" - ) + if self.value == ImageType.APPLICATION.value: + return "application" + if self.value == ImageType.SUSE_APPCOLLECTION.value: + return "appcollection" + return "bci" def create_BCI( @@ -349,7 +348,7 @@ def create_BCI( marks.append(pytest.mark.__getattr__(build_tag_base.replace(":", "_"))) if OS_VERSION == "tumbleweed": - if bci_type in (ImageType.APPLICATION, ImageType.SAC_APPLICATION): + if bci_type in (ImageType.APPLICATION, ImageType.SUSE_APPCOLLECTION): baseurl = ( f"{BASEURL}/{_get_repository_name(image_type)}{build_tag}" ) @@ -541,39 +540,41 @@ def create_BCI( NODEJS_22_CONTAINER, ] -PYTHON36_CONTAINER = create_BCI( - build_tag="bci/python:3.6", available_versions=["15.6"] -) -PYTHON310_CONTAINER = create_BCI( - build_tag="bci/python:3.10", available_versions=["tumbleweed"] -) -PYTHON311_CONTAINER = create_BCI( - build_tag="bci/python:3.11", - available_versions=_DEFAULT_NONBASE_OS_VERSIONS, -) - -PYTHON312_CONTAINER = create_BCI( - build_tag="bci/python:3.12", available_versions=["15.6", "tumbleweed"] -) - -PYTHON313_CONTAINER = create_BCI( - build_tag="bci/python:3.13", available_versions=["15.7", "tumbleweed"] -) - -PYTHON_CONTAINERS = [ - PYTHON36_CONTAINER, - PYTHON310_CONTAINER, - PYTHON311_CONTAINER, - PYTHON312_CONTAINER, - PYTHON313_CONTAINER, -] - PYTHON_WITH_PIPX_CONTAINERS = [ - PYTHON310_CONTAINER, - PYTHON312_CONTAINER, - PYTHON313_CONTAINER, + create_BCI( + build_tag=f"{BCI_CONTAINER_PREFIX}/python:{ver}", + available_versions=versions, + ) + for ver, versions in ( + ("3.10", ["tumbleweed"]), + ("3.12", ["15.6", "tumbleweed"]), + ("3.13", ["15.7", "tumbleweed"]), + ) ] +PYTHON_CONTAINERS = ( + PYTHON_WITH_PIPX_CONTAINERS + + [ + create_BCI( + build_tag=f"{BCI_CONTAINER_PREFIX}/python:{ver}", + available_versions=versions, + ) + for ver, versions in ( + ("3.6", ["15.6"]), + ("3.11", _DEFAULT_NONBASE_OS_VERSIONS), + ) + ] + # Python containers on SUSE Application Collection + + [ + create_BCI( + build_tag=f"{SAC_CONTAINER_PREFIX}/python:{ver}", + available_versions=versions, + bci_type=ImageType.SUSE_APPCOLLECTION, + ) + for ver, versions in (("3.9", ["15.6"]),) + ] +) + RUBY_25_CONTAINER = create_BCI( build_tag="bci/ruby:2.5", available_versions=["15.6"] ) @@ -713,7 +714,7 @@ def create_BCI( POSTFIX_CONTAINERS = [ create_BCI( build_tag=f"{SAC_CONTAINER_PREFIX}/postfix:{postfix_ver}", - bci_type=ImageType.SAC_APPLICATION, + bci_type=ImageType.SUSE_APPCOLLECTION, available_versions=os_versions, forwarded_ports=[PortForwarding(container_port=25)], extra_environment_variables={"SERVER_HOSTNAME": "localhost"}, @@ -828,7 +829,7 @@ def create_BCI( APACHE_TOMCAT_10_CONTAINERS = [ create_BCI( build_tag=f"{SAC_CONTAINER_PREFIX}/apache-tomcat:10.1-openjdk{openjdk_version}", - bci_type=ImageType.SAC_APPLICATION, + bci_type=ImageType.SUSE_APPCOLLECTION, available_versions=("15.6",), forwarded_ports=[PortForwarding(container_port=8080)], container_user="tomcat", @@ -847,7 +848,7 @@ def create_BCI( APACHE_TOMCAT_9_CONTAINERS = [ create_BCI( build_tag=f"{SAC_CONTAINER_PREFIX}/apache-tomcat:9-openjdk{openjdk_version}", - bci_type=ImageType.SAC_APPLICATION, + bci_type=ImageType.SUSE_APPCOLLECTION, available_versions=("15.6",), forwarded_ports=[PortForwarding(container_port=8080)], container_user="tomcat", @@ -927,14 +928,14 @@ def create_BCI( OLLAMA_CONTAINER = create_BCI( build_tag=f"{SAC_CONTAINER_PREFIX}/ollama:0.3", - bci_type=ImageType.SAC_APPLICATION, + bci_type=ImageType.SUSE_APPCOLLECTION, available_versions=["15.6-ai"], forwarded_ports=[PortForwarding(container_port=11434)], ) OPENWEBUI_CONTAINER = create_BCI( build_tag=f"{SAC_CONTAINER_PREFIX}/open-webui:0.3", - bci_type=ImageType.SAC_APPLICATION, + bci_type=ImageType.SUSE_APPCOLLECTION, available_versions=["15.6-ai"], forwarded_ports=[PortForwarding(container_port=8080)], ) diff --git a/pyproject.toml b/pyproject.toml index 104fdf4e..b7f803ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -126,6 +126,7 @@ markers = [ 'postgres_16', 'postgres_17', 'prometheus_2', + 'python_3.9', 'python_3.10', 'python_3.11', 'python_3.12', diff --git a/tests/test_metadata.py b/tests/test_metadata.py index 0ee4ed69..995a689f 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -171,7 +171,7 @@ def _get_container_label_prefix( ] + [(kiwi, "kiwi", ImageType.LANGUAGE_STACK) for kiwi in KIWI_CONTAINERS] + [ - (tomcat_ctr, "apache-tomcat", ImageType.SAC_APPLICATION) + (tomcat_ctr, "apache-tomcat", ImageType.SUSE_APPCOLLECTION) for tomcat_ctr in TOMCAT_CONTAINERS ] + [ @@ -219,7 +219,7 @@ def _get_container_label_prefix( for mariab_client_container in MARIADB_CLIENT_CONTAINERS ] + [ - (postfix_container, "postfix", ImageType.SAC_APPLICATION) + (postfix_container, "postfix", ImageType.SUSE_APPCOLLECTION) for postfix_container in POSTFIX_CONTAINERS ] + [ @@ -316,9 +316,8 @@ def test_general_labels( _get_container_label_prefix(container_name, container_type), "org.opencontainers.image", ): - if ( - container_name != "base" - and container_type != ImageType.SAC_APPLICATION + if container_name != "base" and container_type not in ( + ImageType.SUSE_APPCOLLECTION, ): if OS_VERSION == "tumbleweed": assert ( @@ -353,7 +352,7 @@ def test_general_labels( "https://www.opensuse.org", "https://www.opensuse.org/", ) - elif container_type in (ImageType.SAC_APPLICATION,): + elif container_type in (ImageType.SUSE_APPCOLLECTION,): expected_url = ( f"https://apps.rancher.io/applications/{container_name}", ) @@ -387,7 +386,7 @@ def test_general_labels( if container_type in ( ImageType.OS_LTSS, ImageType.APPLICATION, - ImageType.SAC_APPLICATION, + ImageType.SUSE_APPCOLLECTION, ): assert labels["com.suse.eula"] == "sle-eula" else: @@ -603,13 +602,13 @@ def test_reference( if OS_VERSION == "tumbleweed": if container_type in ( ImageType.APPLICATION, - ImageType.SAC_APPLICATION, + ImageType.SUSE_APPCOLLECTION, ) or container_name in ("base",): assert reference.startswith("registry.opensuse.org/opensuse/") else: assert reference.startswith("registry.opensuse.org/opensuse/bci/") else: - if container_type == ImageType.SAC_APPLICATION: + if container_type in (ImageType.SUSE_APPCOLLECTION,): assert reference.startswith("dp.apps.rancher.io/containers/") elif container_type == ImageType.APPLICATION or ( OS_VERSION == "15.5" and container_name in ("base",) diff --git a/tests/test_python.py b/tests/test_python.py index fccde61e..56537b96 100644 --- a/tests/test_python.py +++ b/tests/test_python.py @@ -174,8 +174,8 @@ def test_pip_install_source_cryptography(auto_container_per_test): "echo $PYTHON_VERSION" ) - if packaging.version.Version(version) < packaging.version.Version("3.8"): - pytest.skip("cryptography tests only supported on >= 3.8") + if packaging.version.Version(version) < packaging.version.Version("3.10"): + pytest.skip("cryptography tests only supported on >= 3.10") # install dependencies auto_container_per_test.connection.run_expect(