Skip to content

Commit

Permalink
Merge pull request #110 from jlausuch/busybox_no_zypper
Browse files Browse the repository at this point in the history
Add BUSYBOX_CONTAINER to CONTAINERS_WITHOUT_ZYPPER
  • Loading branch information
dcermak committed May 5, 2022
2 parents c9a9f89 + 53548ae commit c94b120
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions bci_tester/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ def create_BCI(
CONTAINERS_WITHOUT_ZYPPER = [
MINIMAL_CONTAINER,
MICRO_CONTAINER,
BUSYBOX_CONTAINER,
]

#: Containers that are directly pulled from registry.suse.de
Expand Down
10 changes: 8 additions & 2 deletions tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pytest_container import MultiStageBuild

from bci_tester.data import ALL_CONTAINERS
from bci_tester.data import BUSYBOX_CONTAINER
from bci_tester.data import GO_1_16_CONTAINER
from bci_tester.data import INIT_CONTAINER
from bci_tester.data import OS_PRETTY_NAME
Expand Down Expand Up @@ -77,13 +78,18 @@ def test_product(auto_container):
)


def test_coreutils_present(auto_container):
@pytest.mark.parametrize(
"container",
[c for c in ALL_CONTAINERS if c != BUSYBOX_CONTAINER],
indirect=True,
)
def test_coreutils_present(container):
"""
Check that some core utilities (:command:`cat`, :command:`sh`, etc.) exist
in the container.
"""
for binary in ("cat", "sh", "bash", "ls", "rm"):
assert auto_container.connection.exists(binary)
assert container.connection.exists(binary)


def test_glibc_present(auto_container):
Expand Down
2 changes: 2 additions & 0 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

from bci_tester.data import ALL_CONTAINERS
from bci_tester.data import BASE_CONTAINER
from bci_tester.data import BUSYBOX_CONTAINER
from bci_tester.data import CONTAINER_389DS
from bci_tester.data import DOTNET_ASPNET_3_1_CONTAINER
from bci_tester.data import DOTNET_ASPNET_5_0_CONTAINER
Expand Down Expand Up @@ -87,6 +88,7 @@ def _get_container_label_prefix(
(BASE_CONTAINER, "base", ImageType.OS),
(MINIMAL_CONTAINER, "minimal", ImageType.OS),
(MICRO_CONTAINER, "micro", ImageType.OS),
(BUSYBOX_CONTAINER, "busybox", ImageType.OS),
(GO_1_16_CONTAINER, "golang", ImageType.LANGUAGE_STACK),
(GO_1_17_CONTAINER, "golang", ImageType.LANGUAGE_STACK),
(GO_1_18_CONTAINER, "golang", ImageType.LANGUAGE_STACK),
Expand Down
10 changes: 5 additions & 5 deletions tests/test_minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
import pytest
from pytest_container.runtime import LOCALHOST

from bci_tester.data import CONTAINERS_WITHOUT_ZYPPER
from bci_tester.data import MICRO_CONTAINER
from bci_tester.data import MINIMAL_CONTAINER


CONTAINER_IMAGES = CONTAINERS_WITHOUT_ZYPPER

#: size limits of the minimal image per architecture in MiB
MINIMAL_IMAGE_MAX_SIZE: Dict[str, int] = {
"x86_64": 40,
Expand Down Expand Up @@ -54,7 +51,10 @@ def test_minimal_image_size(
)


def test_fat_packages_absent(auto_container):
@pytest.mark.parametrize(
"container", [MICRO_CONTAINER, MINIMAL_CONTAINER], indirect=True
)
def test_fat_packages_absent(container):
"""Verify that the following binaries do not exist:
- :command:`zypper`
- :command:`grep`
Expand All @@ -64,7 +64,7 @@ def test_fat_packages_absent(auto_container):
- :command:`man`
"""
for pkg in ("zypper", "grep", "diff", "sed", "info", "man"):
assert not auto_container.connection.exists(pkg)
assert not container.connection.exists(pkg)


@pytest.mark.parametrize(
Expand Down

0 comments on commit c94b120

Please sign in to comment.