mirror of
https://github.com/borgbackup/borg.git
synced 2026-02-20 00:10:35 -05:00
read_only CM: skip test if cmd_immutable is unsuccessful, fixes #9021
This commit is contained in:
parent
aa39d63718
commit
4edd0e6e9d
1 changed files with 6 additions and 1 deletions
|
|
@ -337,7 +337,12 @@ class BaseTestCase(unittest.TestCase):
|
|||
self.skipTest(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.
|
||||
self.skipTest('Unable to make path immutable with: %s (rc=%d)' % (cmd_immutable, rc))
|
||||
yield
|
||||
finally:
|
||||
# Restore permissions to ensure clean-up doesn't fail
|
||||
|
|
|
|||
Loading…
Reference in a new issue