Skip to content

Commit

Permalink
Add testing for the SAC 3.9 + 3.11 Python containers
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkmueller committed Dec 6, 2024
1 parent 24e3bd6 commit 5b47ac6
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 39 deletions.
70 changes: 36 additions & 34 deletions bci_tester/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ class ImageType(enum.Enum):
"""

LANGUAGE_STACK = enum.auto()
SAC_LANGUAGE_STACK = enum.auto()
APPLICATION = enum.auto()
SAC_APPLICATION = enum.auto()
OS = enum.auto()
Expand All @@ -262,12 +263,11 @@ class ImageType(enum.Enum):
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.SAC_APPLICATION.value:
return "application"
return "bci"


def create_BCI(
Expand Down Expand Up @@ -562,37 +562,37 @@ 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_WITH_PIPX_CONTAINERS = [
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 = [
PYTHON36_CONTAINER,
PYTHON310_CONTAINER,
PYTHON311_CONTAINER,
PYTHON312_CONTAINER,
PYTHON313_CONTAINER,
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_WITH_PIPX_CONTAINERS = [
PYTHON310_CONTAINER,
PYTHON312_CONTAINER,
PYTHON313_CONTAINER,
# Python containers on SUSE Application Collection
SAC_PYTHON_CONTAINERS = [
create_BCI(
build_tag=f"{SAC_CONTAINER_PREFIX}/python:{ver}",
available_versions=versions,
bci_type=ImageType.SAC_LANGUAGE_STACK,
)
for ver, versions in (("3.9", ["15.6"]), ("3.11", ["15.6"]))
]

RUBY_25_CONTAINER = create_BCI(
Expand Down Expand Up @@ -984,6 +984,7 @@ def create_BCI(
+ PCP_CONTAINERS
+ PROMETHEUS_CONTAINERS
+ PYTHON_CONTAINERS
+ SAC_PYTHON_CONTAINERS
+ RUBY_CONTAINERS
+ RUST_CONTAINERS
+ SPACK_CONTAINERS
Expand Down Expand Up @@ -1061,6 +1062,7 @@ def create_BCI(
+ OPENJDK_CONTAINERS
+ PCP_CONTAINERS
+ PYTHON_CONTAINERS
+ SAC_PYTHON_CONTAINERS
+ RUBY_CONTAINERS
+ RUST_CONTAINERS
+ SPACK_CONTAINERS
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ markers = [
'postgres_16',
'postgres_17',
'prometheus_2',
'python_3.9',
'python_3.10',
'python_3.11',
'python_3.12',
Expand Down
16 changes: 14 additions & 2 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
from bci_tester.data import RUBY_25_CONTAINER
from bci_tester.data import RUBY_33_CONTAINER
from bci_tester.data import RUST_CONTAINERS
from bci_tester.data import SAC_PYTHON_CONTAINERS
from bci_tester.data import SPACK_CONTAINERS
from bci_tester.data import TOMCAT_CONTAINERS
from bci_tester.data import ImageType
Expand Down Expand Up @@ -164,6 +165,10 @@ def _get_container_label_prefix(
(NGINX_CONTAINER, "nginx", ImageType.APPLICATION),
]
+ [(c, "python", ImageType.LANGUAGE_STACK) for c in PYTHON_CONTAINERS]
+ [
(c, "python", ImageType.SAC_LANGUAGE_STACK)
for c in SAC_PYTHON_CONTAINERS
]
+ [(c, "base-fips", ImageType.OS) for c in BASE_FIPS_CONTAINERS]
+ [
(container_pcp, "pcp", ImageType.APPLICATION)
Expand Down Expand Up @@ -353,7 +358,10 @@ def test_general_labels(
"https://www.opensuse.org",
"https://www.opensuse.org/",
)
elif container_type in (ImageType.SAC_APPLICATION,):
elif container_type in (
ImageType.SAC_LANGUAGE_STACK,
ImageType.SAC_APPLICATION,
):
expected_url = (
f"https://apps.rancher.io/applications/{container_name}",
)
Expand Down Expand Up @@ -387,6 +395,7 @@ def test_general_labels(
if container_type in (
ImageType.OS_LTSS,
ImageType.APPLICATION,
ImageType.SAC_LANGUAGE_STACK,
ImageType.SAC_APPLICATION,
):
assert labels["com.suse.eula"] == "sle-eula"
Expand Down Expand Up @@ -609,7 +618,10 @@ def test_reference(
else:
assert reference.startswith("registry.opensuse.org/opensuse/bci/")
else:
if container_type == ImageType.SAC_APPLICATION:
if container_type in (
ImageType.SAC_LANGUAGE_STACK,
ImageType.SAC_APPLICATION,
):
assert reference.startswith("dp.apps.rancher.io/containers/")
elif container_type == ImageType.APPLICATION or (
OS_VERSION == "15.5" and container_name in ("base",)
Expand Down
7 changes: 4 additions & 3 deletions tests/test_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from bci_tester.data import OS_VERSION
from bci_tester.data import PYTHON_CONTAINERS
from bci_tester.data import PYTHON_WITH_PIPX_CONTAINERS
from bci_tester.data import SAC_PYTHON_CONTAINERS
from bci_tester.runtime_choice import PODMAN_SELECTED

BCDIR = "/tmp/"
Expand All @@ -41,7 +42,7 @@
"""

#: Base containers under test, input of auto_container fixture
CONTAINER_IMAGES = PYTHON_CONTAINERS
CONTAINER_IMAGES = PYTHON_CONTAINERS + SAC_PYTHON_CONTAINERS


#: Derived containers, from custom Dockerfile including additional test files
Expand Down Expand Up @@ -174,8 +175,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(
Expand Down

0 comments on commit 5b47ac6

Please sign in to comment.