Skip to content

Commit 5349835

Browse files
Merge pull request #863 from jstourac/readme
NO-JIRA: chore(tests) Update readme for tests execution + some test fixes for linux env
2 parents adbd066 + 55a5ef2 commit 5349835

File tree

2 files changed

+40
-6
lines changed

2 files changed

+40
-6
lines changed

README.md

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,51 @@ Note: To ensure the GitHub Action runs successfully, users must add a `GH_ACCESS
5959

6060
### Deploy & Test
6161

62-
#### Running Python selftests in Pytest
62+
#### Prepare Python + poetry + pytest env
6363

6464
```shell
65-
pip install poetry
66-
poetry env use /usr/bin/python3.12
65+
# Linux
66+
sudo dnf install python3.12
67+
pip install --user poetry
68+
# MacOS
69+
brew install [email protected] poetry
70+
71+
poetry env use $(which python3.12)
6772
poetry config virtualenvs.in-project true
73+
poetry env info
6874
poetry install --sync
75+
```
6976

77+
#### Running Python selftests in Pytest
78+
By completing configuration in previous section, you are able to run any tests that don't need to start a container using following command:
79+
80+
```
7081
poetry run pytest
7182
```
7283

84+
#### Running testcontainers tests in Pytest
85+
```
86+
# Podman/Docker config
87+
# Linux
88+
sudo dnf install podman
89+
systemctl --user start podman.service
90+
systemctl --user status podman.service
91+
systemctl --user status podman.socket
92+
DOCKER_HOST=unix:///run/user/$UID/podman/podman.sock poetry run pytest tests/containers --image quay.io/opendatahub/workbench-images@sha256:e98d19df346e7abb1fa3053f6d41f0d1fa9bab39e49b4cb90b510ca33452c2e4
93+
94+
# Mac OS
95+
brew install podman
96+
podman machine init
97+
podman machine set --rootful
98+
sudo podman-mac-helper install
99+
podman machine start
100+
poetry run pytest tests/containers --image quay.io/opendatahub/workbench-images@sha256:e98d19df346e7abb1fa3053f6d41f0d1fa9bab39e49b4cb90b510ca33452c2e4
101+
```
102+
103+
#### Running Playwright tests in Pytest
104+
105+
[tests/browser/README.md](tests/browser/README.md)
106+
73107
#### Notebooks
74108

75109
Deploy the notebook images in your Kubernetes environment using:

tests/containers/base_image_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TestBaseImage:
2121
"""Tests that are applicable for all images we have in this repository."""
2222

2323
def test_oc_command_runs(self, image: str):
24-
container = testcontainers.core.container.DockerContainer(image=image, user=123456, group_add=[0])
24+
container = testcontainers.core.container.DockerContainer(image=image, user=23456, group_add=[0])
2525
container.with_command("/bin/sh -c 'sleep infinity'")
2626
try:
2727
container.start()
@@ -50,8 +50,8 @@ def test_oc_command_runs_fake_fips(self, image: str, subtests: pytest_subtests.S
5050
# tmpdir is by-default created with perms restricting access to user only
5151
tmp_crypto.chmod(0o777)
5252

53-
container = testcontainers.core.container.DockerContainer(image=image, user=654321, group_add=[0])
54-
container.with_volume_mapping(str(tmp_crypto), "/proc/sys")
53+
container = testcontainers.core.container.DockerContainer(image=image, user=54321, group_add=[0])
54+
container.with_volume_mapping(str(tmp_crypto), "/proc/sys", mode="ro,z")
5555
container.with_command("/bin/sh -c 'sleep infinity'")
5656

5757
try:

0 commit comments

Comments
 (0)