From aef45807fac4438379f60fd0de393c72018676ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Tue, 26 Nov 2024 15:59:56 +0100 Subject: [PATCH 1/4] Remove superfluous return `pytest.skip` stops the test execution, no need to return --- tests/test_all.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_all.py b/tests/test_all.py index dea2d279..8c1eb60d 100644 --- a/tests/test_all.py +++ b/tests/test_all.py @@ -471,7 +471,7 @@ def test_bci_eula_is_correctly_available(container: ContainerData) -> None: MICRO_CONTAINER.values[0], ): pytest.skip("Unmaintained bci-* base os containers are not tested") - return + assert not container.connection.file( bci_license ).exists, "BCI EULA shall not be in LTSS container" From aa75e54b7c9c87329dc1543580dbde8fb16766bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Tue, 26 Nov 2024 16:00:59 +0100 Subject: [PATCH 2/4] Allow SUSE AI containers to be run in `all` tests --- bci_tester/data.py | 16 ++++++++++++---- tests/test_all.py | 4 ++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/bci_tester/data.py b/bci_tester/data.py index be20bf66..1a337d90 100755 --- a/bci_tester/data.py +++ b/bci_tester/data.py @@ -52,7 +52,13 @@ ) # Allowed os versions for SLE_BCI repo checks -ALLOWED_BCI_REPO_OS_VERSIONS = ("15.5", "15.6", "15.7", "tumbleweed") +ALLOWED_BCI_REPO_OS_VERSIONS = ( + "15.5", + "15.6", + "15.6-ai", + "15.7", + "tumbleweed", +) # Test Language and Application containers by default for these versions _DEFAULT_NONBASE_SLE_VERSIONS = ("15.6", "15.7") @@ -64,7 +70,7 @@ _DEFAULT_BASE_OS_VERSIONS = ("15.5", "15.6", "15.7", "16.0", "tumbleweed") # List the released versions of SLE, used for supportabilty and EULA tests -RELEASED_SLE_VERSIONS = ("15.3", "15.4", "15.5", "15.6") +RELEASED_SLE_VERSIONS = ("15.3", "15.4", "15.5", "15.6", "15.6-ai") assert ( sorted(ALLOWED_BASE_OS_VERSIONS) == list(ALLOWED_BASE_OS_VERSIONS) @@ -106,10 +112,10 @@ SAC_CONTAINER_PREFIX = "containers" BCI_CONTAINER_PREFIX = "bci" OS_CONTAINER_TAG = OS_VERSION - OS_VERSION_ID = OS_VERSION + OS_VERSION_ID = OS_VERSION.partition("-")[0] OS_MAJOR_VERSION, OS_SP_VERSION = ( - int(ver) for ver in OS_VERSION.partition("-")[0].split(".") + int(ver) for ver in OS_VERSION_ID.split(".") ) #: The SLES 15 pretty name (from /etc/os-release) @@ -968,6 +974,7 @@ def create_BCI( PHP_8_APACHE, PHP_8_CLI, PHP_8_FPM, + OPENWEBUI_CONTAINER, ] + ALERTMANAGER_CONTAINERS + BASE_FIPS_CONTAINERS @@ -1020,6 +1027,7 @@ def create_BCI( *COSIGN_CONTAINERS, MICRO_CONTAINER, MINIMAL_CONTAINER, + OLLAMA_CONTAINER, *POSTFIX_CONTAINERS, *TOMCAT_CONTAINERS, *POSTGRESQL_CONTAINERS, diff --git a/tests/test_all.py b/tests/test_all.py index 8c1eb60d..3cd9219d 100644 --- a/tests/test_all.py +++ b/tests/test_all.py @@ -323,6 +323,10 @@ def test_no_downgrade_on_install(container: ContainerData) -> None: OS_VERSION not in ALLOWED_BCI_REPO_OS_VERSIONS, reason="LTSS containers are known to be non-functional with BCI_repo ", ) +@pytest.mark.skipif( + OS_VERSION == "15.6-ai", + reason="AI containers include unpublished packages", +) @pytest.mark.parametrize( "container_per_test", CONTAINERS_WITH_ZYPPER_AS_ROOT, indirect=True ) From 290e47a25be084caa75a530445a94a00e67fc33f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Tue, 26 Nov 2024 16:01:26 +0100 Subject: [PATCH 3/4] Add sanity check to test_all that zypper is actually missing in marked containers --- tests/test_all.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_all.py b/tests/test_all.py index 3cd9219d..ba2207ee 100644 --- a/tests/test_all.py +++ b/tests/test_all.py @@ -26,6 +26,7 @@ from bci_tester.data import BCI_DEVEL_REPO from bci_tester.data import BCI_REPO_NAME from bci_tester.data import BUSYBOX_CONTAINER +from bci_tester.data import CONTAINERS_WITHOUT_ZYPPER from bci_tester.data import CONTAINERS_WITH_ZYPPER from bci_tester.data import CONTAINERS_WITH_ZYPPER_AS_ROOT from bci_tester.data import DISTRIBUTION_CONTAINER @@ -396,6 +397,17 @@ def test_zypper_verify_passes(container: ContainerData) -> None: ) +@pytest.mark.parametrize("container", CONTAINERS_WITHOUT_ZYPPER, indirect=True) +def test_zypper_not_present_in_containers_without_it( + container: ContainerData, +) -> None: + """Sanity check that containers which are expected to not contain zypper, + actually do not contain it. + + """ + container.connection.run_expect([1, 127], "command -v zypper") + + # PCP_CONTAINERS: uses systemd for starting multiple services # KIWI_CONTAINERS: pulls lvm2 which pulls systemd @pytest.mark.parametrize( From a1dd6a7690cf2915116467c8a29fa60b55d571d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Wed, 27 Nov 2024 10:44:50 +0100 Subject: [PATCH 4/4] Enable metadata tests for the AI images --- bci_tester/data.py | 2 ++ tests/test_metadata.py | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bci_tester/data.py b/bci_tester/data.py index 1a337d90..ba1d5459 100755 --- a/bci_tester/data.py +++ b/bci_tester/data.py @@ -1055,6 +1055,8 @@ def create_BCI( PHP_8_APACHE, PHP_8_CLI, PHP_8_FPM, + OLLAMA_CONTAINER, + OPENWEBUI_CONTAINER, ] + BASE_FIPS_CONTAINERS + CONTAINER_389DS_CONTAINERS diff --git a/tests/test_metadata.py b/tests/test_metadata.py index 0ee4ed69..197db9c5 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -61,6 +61,7 @@ from bci_tester.data import NODEJS_18_CONTAINER from bci_tester.data import NODEJS_20_CONTAINER from bci_tester.data import NODEJS_22_CONTAINER +from bci_tester.data import OLLAMA_CONTAINER from bci_tester.data import OPENJDK_11_CONTAINER from bci_tester.data import OPENJDK_17_CONTAINER from bci_tester.data import OPENJDK_21_CONTAINER @@ -69,8 +70,10 @@ from bci_tester.data import OPENJDK_DEVEL_17_CONTAINER from bci_tester.data import OPENJDK_DEVEL_21_CONTAINER from bci_tester.data import OPENJDK_DEVEL_23_CONTAINER +from bci_tester.data import OPENWEBUI_CONTAINER from bci_tester.data import OS_SP_VERSION from bci_tester.data import OS_VERSION +from bci_tester.data import OS_VERSION_ID from bci_tester.data import PCP_CONTAINERS from bci_tester.data import PHP_8_APACHE from bci_tester.data import PHP_8_CLI @@ -278,6 +281,10 @@ def _get_container_label_prefix( (cont, "base-fips", ImageType.OS_LTSS) for cont in LTSS_BASE_FIPS_CONTAINERS ] + + [ + (OLLAMA_CONTAINER, "ollama", ImageType.SAC_APPLICATION), + (OPENWEBUI_CONTAINER, "open-webui", ImageType.SAC_APPLICATION), + ] ] @@ -378,7 +385,7 @@ def test_general_labels( # no EULA for openSUSE images else: assert ( - labels["com.suse.lifecycle-url"] + labels["com.suse.lifecycle-url"].removesuffix("/") in ( "https://www.suse.com/lifecycle#suse-linux-enterprise-server-15", "https://www.suse.com/lifecycle", # SLE 15 SP5 base container has incorrect URL @@ -670,7 +677,7 @@ def test_oci_base_refs( assert base_name.startswith("registry.suse.com/") assert ( - f":{OS_VERSION}" in base_name + f":{OS_VERSION_ID}" in base_name ), "Base image reference is not the expected version" assert base_digest.startswith("sha256:")