Skip to content

Commit

Permalink
test: Avoid test failure on Linux root without cap-add LINUX_IMMUTABLE
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoFalke committed Sep 27, 2023
1 parent b000ed5 commit fa40b3e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/functional/feature_reindex_readonly.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Start a node, generate blocks, then restart with -reindex after setting blk files to read-only
"""

import os
import platform
import stat
import subprocess
Expand Down Expand Up @@ -45,6 +46,11 @@ def reindex_readonly(self):
self.log.warning(f"stdout: {e.stdout}")
if e.stderr:
self.log.warning(f"stderr: {e.stderr}")
if os.getuid() == 0:
self.log.warning("Return early on Linux under root, because chattr failed.")
self.log.warning("This should only happen due to missing capabilities in a container.")
self.log.warning("Make sure to --cap-add LINUX_IMMUTABLE if you want to run this test.")
return

self.log.debug("Attempt to restart and reindex the node with the unwritable block file")
with self.nodes[0].assert_debug_log(expected_msgs=['FlushStateToDisk', 'failed to open file'], unexpected_msgs=[]):
Expand Down

0 comments on commit fa40b3e

Please sign in to comment.