test: Harden testing of cookie file existence

This commit is contained in:
Hodlinator 2024-11-25 10:41:50 +01:00
parent 75bacabb55
commit 6e28c76907
No known key found for this signature in database

View file

@ -166,8 +166,15 @@ class HTTPBasicsTest(BitcoinTestFramework):
self.stop_node(0)
self.log.info('Check that failure to write cookie file will abort the node gracefully')
(self.nodes[0].chain_path / ".cookie.tmp").mkdir()
cookie_path = self.nodes[0].chain_path / ".cookie"
cookie_path_tmp = self.nodes[0].chain_path / ".cookie.tmp"
cookie_path_tmp.mkdir()
self.nodes[0].assert_start_raises_init_error(expected_msg=init_error)
cookie_path_tmp.rmdir()
assert not cookie_path.exists()
self.restart_node(0)
assert cookie_path.exists()
self.stop_node(0)
self.test_rpccookieperms()