Skip to content

Commit 3aee110

Browse files
Merge pull request #9025 from ThomasWaldmann/fix-readonly-tests-master
read_only CM: skip test if cmd_immutable is unsuccessful, fixes #9021
2 parents 3bff0c3 + e5a5d67 commit 3aee110

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/borg/testsuite/archiver/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,12 @@ def read_only(path):
440440
pytest.skip(message)
441441
try:
442442
os.system('LD_PRELOAD= chmod -R ugo-w "%s"' % path)
443-
os.system(cmd_immutable)
443+
rc = os.system(cmd_immutable)
444+
if rc != 0:
445+
# If we cannot make the path immutable (e.g., missing CAP_LINUX_IMMUTABLE
446+
# in containers or restricted environments), the read-only tests would
447+
# not be meaningful. Skip them instead of failing.
448+
pytest.skip(f"Unable to make path immutable with: {cmd_immutable} (rc={rc})")
444449
yield
445450
finally:
446451
# Restore permissions to ensure clean-up doesn't fail

0 commit comments

Comments
 (0)