Skip to content

Commit

Permalink
Check for BCI and BETA EULA to be in place
Browse files Browse the repository at this point in the history
Co-authored-by: Dan Čermák <[email protected]>
  • Loading branch information
dirkmueller and dcermak committed Apr 30, 2024
1 parent f2f8195 commit 24fd2d4
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bci_tester/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
# Test Language and Application containers by default for these versions
_DEFAULT_NONBASE_OS_VERSIONS = ("15.5", "15.6", "tumbleweed")

# List the released versions of SLE, used for supportabilty and EULA tests
RELEASED_SLE_VERSIONS = ("15.3", "15.4", "15.5")

assert sorted(ALLOWED_BASE_OS_VERSIONS) == list(
ALLOWED_BASE_OS_VERSIONS
), f"list ALLOWED_OS_VERSIONS must be sorted, but got {ALLOWED_BASE_OS_VERSIONS}"
Expand Down
62 changes: 62 additions & 0 deletions tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,22 @@

from bci_tester.data import ALL_CONTAINERS
from bci_tester.data import ALLOWED_BCI_REPO_OS_VERSIONS
from bci_tester.data import BASE_CONTAINER
from bci_tester.data import BCI_REPO_NAME
from bci_tester.data import BUSYBOX_CONTAINER
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
from bci_tester.data import INIT_CONTAINER
from bci_tester.data import KERNEL_MODULE_CONTAINER
from bci_tester.data import LTSS_BASE_FIPS_CONTAINERS
from bci_tester.data import MICRO_CONTAINER
from bci_tester.data import MINIMAL_CONTAINER
from bci_tester.data import OS_PRETTY_NAME
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 RELEASED_SLE_VERSIONS
from bci_tester.data import RUST_CONTAINERS


Expand Down Expand Up @@ -438,6 +443,63 @@ def test_no_compat_packages(container):
).is_installed


@pytest.mark.parametrize(
"container",
ALL_CONTAINERS,
indirect=True,
)
def test_bci_eula_is_correctly_available(container: ContainerData) -> None:
"""Ensure that the BCI eula exists iff it's not a LTSS container"""

bci_license = "/usr/share/licenses/product/BCI/license.txt"
if OS_VERSION in ALLOWED_BCI_REPO_OS_VERSIONS and OS_VERSION in (
*RELEASED_SLE_VERSIONS,
"15.6",
):
assert container.connection.file(bci_license).exists
assert (
"SUSE Linux Enterprise Base Container Image License"
in container.connection.check_output(f"head -n 1 {bci_license}")
)
return

# LTSS containers should not have the BCI license, however we currently
# are running tests for the bci-* base os containers which are not LTSS
# and still contain a BCI license. As they are out of maintenance, we
# need to ignore them
if OS_VERSION in RELEASED_SLE_VERSIONS and container.container in (
BASE_CONTAINER.values[0],
INIT_CONTAINER.values[0],
MINIMAL_CONTAINER.values[0],
LTSS_BASE_FIPS_CONTAINERS.values[0],
MICRO_CONTAINER.values[0],
):
pytest.skip("Unmaintained bci-* base os containers are not tested")
return
assert not container.connection.file(bci_license).exists


@pytest.mark.skipif(
OS_VERSION in RELEASED_SLE_VERSIONS
or OS_VERSION in ("basalt", "tumbleweed"),
reason="BETA EULA not expected",
)
@pytest.mark.parametrize(
"container",
ALL_CONTAINERS,
indirect=True,
)
def test_sles_beta_eula_exists(container):
"""Ensure that the SLES Beta eula exists in the container"""

assert (
"SUSE(R) End User License Agreement for Beta Software"
in container.connection.check_output(
"head -n 1 /usr/share/licenses/product/base/license.txt"
)
)


@pytest.mark.parametrize("runner", ALL_CONTAINERS)
def test_certificates_are_present(
host, tmp_path, container_runtime, runner: Container, pytestconfig: Config
Expand Down

0 comments on commit 24fd2d4

Please sign in to comment.