aboutsummaryrefslogtreecommitdiff
path: root/test/functional/feature_filelock.py
diff options
context:
space:
mode:
authorwillcl-ark <will@256k1.dev>2023-11-27 10:29:02 +0000
committerwillcl-ark <will@256k1.dev>2023-12-04 12:54:20 +0000
commit8f6ab318635d823a7e6ad9020ac17b8d2dd0e91b (patch)
treefbecfe3431f4cf8a46406771e97b4a28c2b11900 /test/functional/feature_filelock.py
parent160d23677ad799cf9b493eaa923b2ac080c3fb8e (diff)
downloadbitcoin-8f6ab318635d823a7e6ad9020ac17b8d2dd0e91b.tar.xz
init: don't delete PID file if it was not generated
Previously, starting a second bitcoind using the same datadir would correctly fail to init and shutdown. However during shutdown the PID file belonging to the first instance would be erroneously removed by the second process shutting down. Fix this to only delete the PID file if we created it.
Diffstat (limited to 'test/functional/feature_filelock.py')
-rwxr-xr-xtest/functional/feature_filelock.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/functional/feature_filelock.py b/test/functional/feature_filelock.py
index 0f4be54d0e..567207915e 100755
--- a/test/functional/feature_filelock.py
+++ b/test/functional/feature_filelock.py
@@ -30,8 +30,11 @@ class FilelockTest(BitcoinTestFramework):
expected_msg = f"Error: Cannot obtain a lock on data directory {datadir}. {self.config['environment']['PACKAGE_NAME']} is probably already running."
self.nodes[1].assert_start_raises_init_error(extra_args=[f'-datadir={self.nodes[0].datadir_path}', '-noserver'], expected_msg=expected_msg)
+ self.log.info("Check that cookie and PID file are not deleted when attempting to start a second bitcoind using the same datadir")
cookie_file = datadir / ".cookie"
assert cookie_file.exists() # should not be deleted during the second bitcoind instance shutdown
+ pid_file = datadir / "bitcoind.pid"
+ assert pid_file.exists()
if self.is_wallet_compiled():
def check_wallet_filelock(descriptors):