Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable AI containers for tox -e all #672

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions bci_tester/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -948,6 +954,7 @@ def create_BCI(
PHP_8_APACHE,
PHP_8_CLI,
PHP_8_FPM,
OPENWEBUI_CONTAINER,
]
+ ALERTMANAGER_CONTAINERS
+ BASE_FIPS_CONTAINERS
Expand Down Expand Up @@ -1000,6 +1007,7 @@ def create_BCI(
*COSIGN_CONTAINERS,
MICRO_CONTAINER,
MINIMAL_CONTAINER,
OLLAMA_CONTAINER,
*POSTFIX_CONTAINERS,
*TOMCAT_CONTAINERS,
*POSTGRESQL_CONTAINERS,
Expand Down Expand Up @@ -1027,6 +1035,8 @@ def create_BCI(
PHP_8_APACHE,
PHP_8_CLI,
PHP_8_FPM,
OLLAMA_CONTAINER,
OPENWEBUI_CONTAINER,
]
+ BASE_FIPS_CONTAINERS
+ CONTAINER_389DS_CONTAINERS
Expand Down
18 changes: 17 additions & 1 deletion tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -323,6 +324,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
)
Expand Down Expand Up @@ -399,6 +404,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(
Expand Down Expand Up @@ -478,7 +494,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"
Expand Down
11 changes: 9 additions & 2 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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),
]
]


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:")

Expand Down
Loading