Skip to content

Commit

Permalink
Add testing for the python 3.9 SAC container
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkmueller committed Nov 28, 2024
1 parent 7fae3a3 commit 5ccf78a
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 54 deletions.
87 changes: 44 additions & 43 deletions bci_tester/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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}"
)
Expand Down Expand Up @@ -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"]
)
Expand Down Expand Up @@ -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"},
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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)],
)
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
17 changes: 8 additions & 9 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
+ [
Expand Down Expand Up @@ -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
]
+ [
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -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}",
)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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",)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 5ccf78a

Please sign in to comment.