Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add testing for the python 3.9 SAC container
Browse files Browse the repository at this point in the history
dirkmueller committed Dec 5, 2024
1 parent c676677 commit fd8df2e
Showing 4 changed files with 54 additions and 52 deletions.
87 changes: 44 additions & 43 deletions bci_tester/data.py
Original file line number Diff line number Diff line change
@@ -255,19 +255,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 "application"
return "bci"


def create_BCI(
@@ -355,7 +354,7 @@ def create_BCI(
if not baseurl:
raise ValueError("Missing CONTAINER_URL for TARGET manual")
elif 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}"
)
@@ -562,39 +561,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"]
)
@@ -734,7 +735,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"},
@@ -849,7 +850,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",
@@ -868,7 +869,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",
@@ -948,14 +949,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)],
)
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -128,6 +128,7 @@ markers = [
'postgres_16',
'postgres_17',
'prometheus_2',
'python_3.9',
'python_3.10',
'python_3.11',
'python_3.12',
14 changes: 7 additions & 7 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
@@ -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
]
+ [
@@ -318,7 +318,7 @@ def test_general_labels(
):
if (
container_name != "base"
and container_type != ImageType.SAC_APPLICATION
and container_type != ImageType.SUSE_APPCOLLECTION
):
if OS_VERSION == "tumbleweed":
assert (
@@ -353,7 +353,7 @@ def test_general_labels(
"https://www.opensuse.org",
"https://www.opensuse.org/",
)
elif container_type in (ImageType.SAC_APPLICATION,):
elif container_type == ImageType.SUSE_APPCOLLECTION:
expected_url = (
f"https://apps.rancher.io/applications/{container_name}",
)
@@ -387,7 +387,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 +603,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 == 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",)
4 changes: 2 additions & 2 deletions tests/test_python.py
Original file line number Diff line number Diff line change
@@ -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(

0 comments on commit fd8df2e

Please sign in to comment.