mirror of
https://github.com/borgbackup/borg.git
synced 2026-05-07 20:02:36 +00:00
Merge pull request #9025 from ThomasWaldmann/fix-readonly-tests-master
read_only CM: skip test if cmd_immutable is unsuccessful, fixes #9021
This commit is contained in:
@@ -440,7 +440,12 @@ def read_only(path):
|
||||
pytest.skip(message)
|
||||
try:
|
||||
os.system('LD_PRELOAD= chmod -R ugo-w "%s"' % path)
|
||||
os.system(cmd_immutable)
|
||||
rc = os.system(cmd_immutable)
|
||||
if rc != 0:
|
||||
# If we cannot make the path immutable (e.g., missing CAP_LINUX_IMMUTABLE
|
||||
# in containers or restricted environments), the read-only tests would
|
||||
# not be meaningful. Skip them instead of failing.
|
||||
pytest.skip(f"Unable to make path immutable with: {cmd_immutable} (rc={rc})")
|
||||
yield
|
||||
finally:
|
||||
# Restore permissions to ensure clean-up doesn't fail
|
||||
|
||||
Reference in New Issue
Block a user