Skip to content

Commit b5ec92a

Browse files
committed
update base_image_test.py to skip checking uid as it does not matter on openshift (#3020)
1 parent cad8d25 commit b5ec92a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/containers/base_image_test.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def test_file_permissions(self, image: str, subtests: pytest_subtests.SubTests):
233233
expected_uid = "1001" # default
234234
expected_gid = "0" # root
235235
# Directories to assert permissions and ownerships as we did in ODS-CI
236-
directories_to_check: list[str] = [
236+
directories_to_check: list[list[str]] = [
237237
[f"{app_root_path}/lib", "775", expected_gid, expected_uid],
238238
]
239239
if not utils.is_rstudio_image(image):
@@ -243,10 +243,11 @@ def test_file_permissions(self, image: str, subtests: pytest_subtests.SubTests):
243243
def test_fn(container: testcontainers.core.container.DockerContainer):
244244
for item in directories_to_check:
245245
with subtests.test(f"Checking permissions of the: {item[0]}"):
246-
_, output = container.exec(["stat", "--format='%a:%g:%u'", f"{item[0]}"])
246+
# ignore `:%u`, it does not matter what the uid is, it's the gid that is nonrandom on openshift
247+
_, output = container.exec(["stat", "--format='%a:%g'", f"{item[0]}"])
247248
logging.debug(output.decode())
248249
cleaned_output = output.decode().strip().strip("'")
249-
assert cleaned_output == f"{item[1]}:{item[2]}:{item[3]}"
250+
assert cleaned_output == f"{item[1]}:{item[2]}"
250251

251252
self._run_test(image=image, test_fn=test_fn)
252253

0 commit comments

Comments
 (0)