diff options
author | Suhas Daftuar <sdaftuar@gmail.com> | 2018-04-09 14:07:47 -0400 |
---|---|---|
committer | Suhas Daftuar <sdaftuar@gmail.com> | 2018-04-09 14:35:09 -0400 |
commit | 75d0e4c5444249f0cf81ed0494e2c2717170b695 (patch) | |
tree | ff787d226b0b904a08bef79e3d5af3ff3420ec7c /test/functional/test_framework/util.py | |
parent | 2b54155a459c235626fddc4495bb681b93d3dbc5 (diff) | |
download | bitcoin-75d0e4c5444249f0cf81ed0494e2c2717170b695.tar.xz |
[qa] Delete cookie file before starting node
If a cookie file exists in a datadir prior to node startup, it must have
been leftover from a prior unclean shutdown. As bitcoind will overwrite
it anyway, delete it before starting up to prevent the test framework
from inadvertently trying to connect using stale credentials.
Diffstat (limited to 'test/functional/test_framework/util.py')
-rw-r--r-- | test/functional/test_framework/util.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index a24a2ec4f5..f22322fbbc 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -332,6 +332,12 @@ def get_auth_cookie(datadir): raise ValueError("No RPC credentials") return user, password +# If a cookie file exists in the given datadir, delete it. +def delete_cookie_file(datadir): + if os.path.isfile(os.path.join(datadir, "regtest", ".cookie")): + logger.debug("Deleting leftover cookie file") + os.remove(os.path.join(datadir, "regtest", ".cookie")) + def get_bip9_status(node, key): info = node.getblockchaininfo() return info['bip9_softforks'][key] |