Skip to content

Commit fa40b3e

Browse files
author
MarcoFalke
committed
test: Avoid test failure on Linux root without cap-add LINUX_IMMUTABLE
1 parent b000ed5 commit fa40b3e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/functional/feature_reindex_readonly.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Start a node, generate blocks, then restart with -reindex after setting blk files to read-only
77
"""
88

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

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

0 commit comments

Comments
 (0)