@@ -107,6 +107,18 @@ def check_elf_file():
107
107
with subtests .test (f"{ dlib = } " ):
108
108
pytest .fail (f"{ dlib = } has unsatisfied dependencies { deps = } " )
109
109
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
+
110
122
# @pytest.mark.environmentss("docker")
111
123
def test_oc_command_runs_fake_fips (self , image : str , subtests : pytest_subtests .SubTests ):
112
124
"""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
131
143
# if /proc/sys/crypto/fips_enabled exists, only replace this file,
132
144
# otherwise (Ubuntu case), assume entire /proc/sys/crypto does not exist
133
145
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" )
135
148
else :
136
149
container .with_volume_mapping (str (tmp_crypto ), "/proc/sys" , mode = "ro,z" )
137
150
@@ -181,8 +194,7 @@ def test_pip_install_cowsay_runs(self, image: str):
181
194
docker_utils .NotebookContainer (container ).stop (timeout = 0 )
182
195
183
196
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 ]:
186
198
"""Returns a cli command that will run the given Python function encoded inline.
187
199
All dependencies (imports, ...) must be part of function body."""
188
200
code = textwrap .dedent (inspect .getsource (function ))
0 commit comments