Skip to content

Commit 34309e3

Browse files
committed
fixup, restore test_oc_command_runs
1 parent 7094188 commit 34309e3

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

tests/containers/base_image_test.py

+15-3
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,18 @@ def check_elf_file():
107107
with subtests.test(f"{dlib=}"):
108108
pytest.fail(f"{dlib=} has unsatisfied dependencies {deps=}")
109109

110+
def test_oc_command_runs(self, image: str):
111+
container = testcontainers.core.container.DockerContainer(image=image, user=23456, group_add=[0])
112+
container.with_command("/bin/sh -c 'sleep infinity'")
113+
try:
114+
container.start()
115+
ecode, output = container.exec(["/bin/sh", "-c", "oc version"])
116+
finally:
117+
docker_utils.NotebookContainer(container).stop(timeout=0)
118+
119+
logging.debug(output.decode())
120+
assert ecode == 0
121+
110122
# @pytest.mark.environmentss("docker")
111123
def test_oc_command_runs_fake_fips(self, image: str, subtests: pytest_subtests.SubTests):
112124
"""Establishes a best-effort fake FIPS environment and attempts to execute `oc` binary in it.
@@ -131,7 +143,8 @@ def test_oc_command_runs_fake_fips(self, image: str, subtests: pytest_subtests.S
131143
# if /proc/sys/crypto/fips_enabled exists, only replace this file,
132144
# otherwise (Ubuntu case), assume entire /proc/sys/crypto does not exist
133145
if platform.system().lower() == "darwin" or pathlib.Path("/proc/sys/crypto/fips_enabled").exists():
134-
container.with_volume_mapping(str(tmp_crypto / 'crypto' / 'fips_enabled'), "/proc/sys/crypto/fips_enabled", mode="ro,z")
146+
container.with_volume_mapping(str(tmp_crypto / 'crypto' / 'fips_enabled'),
147+
"/proc/sys/crypto/fips_enabled", mode="ro,z")
135148
else:
136149
container.with_volume_mapping(str(tmp_crypto), "/proc/sys", mode="ro,z")
137150

@@ -181,8 +194,7 @@ def test_pip_install_cowsay_runs(self, image: str):
181194
docker_utils.NotebookContainer(container).stop(timeout=0)
182195

183196

184-
def encode_python_function_execution_command_interpreter(python: str, function: Callable[..., Any], *args: list[Any]) -> \
185-
list[str]:
197+
def encode_python_function_execution_command_interpreter(python: str, function: Callable[..., Any], *args: list[Any]) -> list[str]:
186198
"""Returns a cli command that will run the given Python function encoded inline.
187199
All dependencies (imports, ...) must be part of function body."""
188200
code = textwrap.dedent(inspect.getsource(function))

0 commit comments

Comments
 (0)