Skip to content

Commit 9204637

Browse files
committed
Improve test coverage: Add fix-permissions script and pip index-url validation tests #88
- Add file_executable() helper to ContainerRunner - Add test_fix_permissions_executable to verify /usr/local/bin/fix-permissions is present and executable in both Python and CUDA images - Add test_pip_index_url_configured to assert pip global.index-url is actually set (not just that [global] exists) Closes #88 Signed-off-by: Shanmukh Pawan <smoparth@redhat.com>
1 parent ebdbfd2 commit 9204637

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

tests/conftest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ def file_exists(self, path: str) -> bool:
7676
result = self.run(f"test -f {shlex.quote(path)}")
7777
return result.returncode == 0
7878

79+
def file_executable(self, path: str) -> bool:
80+
"""Check if a file exists and is executable."""
81+
result = self.run(f"test -x {shlex.quote(path)}")
82+
return result.returncode == 0
83+
7984
def dir_exists(self, path: str) -> bool:
8085
"""Check if a directory exists."""
8186
result = self.run(f"test -d {shlex.quote(path)}")

tests/test_common.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@ def test_workdir_writable(container):
6767
assert result.returncode == 0
6868

6969

70+
def test_fix_permissions_executable(container):
71+
"""Verify fix-permissions script is installed and executable.
72+
73+
This script is critical for OpenShift compatibility, it ensures GID 0
74+
group write access on directories. If accidentally removed or with wrong
75+
permissions, downstream images break at runtime with permission errors.
76+
"""
77+
assert container.file_executable("/usr/local/bin/fix-permissions"), (
78+
"/usr/local/bin/fix-permissions must exist and be executable"
79+
)
80+
81+
7082
# --- Configuration Tests ---
7183

7284

@@ -81,6 +93,16 @@ def test_pip_conf_valid(container):
8193
assert "[global]" in result.stdout, "pip.conf missing [global] section"
8294

8395

96+
def test_pip_index_url_configured(container):
97+
"""Verify pip global.index-url is configured"""
98+
result = container.run("pip config get global.index-url")
99+
assert result.returncode == 0, (
100+
"pip global.index-url is not set — expected an index-url in /etc/pip.conf"
101+
)
102+
index_url = result.stdout.strip()
103+
assert index_url, "pip global.index-url is set but empty"
104+
105+
84106
def test_uv_toml_exists(container):
85107
"""Verify uv configuration file exists."""
86108
assert container.file_exists("/etc/uv/uv.toml"), "uv configuration file not found"

0 commit comments

Comments
 (0)