Skip to content

Commit a171ed9

Browse files
committed
RHOAIENG-9707: chore(tests/containers): try to install the cowsay package to check the python venv is writable
1 parent a8dbbc9 commit a171ed9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/containers/base_image_test.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,20 @@ def test_oc_command_runs_fake_fips(self, image: str, subtests: pytest_subtests.S
7878
assert ecode == 0, output.decode()
7979
finally:
8080
docker_utils.NotebookContainer(container).stop(timeout=0)
81+
82+
def test_pip_install_cowsay_runs(self, image: str):
83+
"""Checks that the Python virtualenv in the image is writable."""
84+
container = testcontainers.core.container.DockerContainer(image=image, user=23456, group_add=[0])
85+
container.with_command("/bin/sh -c 'sleep infinity'")
86+
try:
87+
container.start()
88+
89+
ecode, output = container.exec(["python3", "-m", "pip", "install", "cowsay"])
90+
logging.debug(output.decode())
91+
assert ecode == 0
92+
93+
ecode, output = container.exec(["python3", "-m", "cowsay", "--text", "Hello world"])
94+
logging.debug(output.decode())
95+
assert ecode == 0
96+
finally:
97+
docker_utils.NotebookContainer(container).stop(timeout=0)

0 commit comments

Comments
 (0)