From 771ad2586a9e1ed31119bec265b4ea30fae002d2 Mon Sep 17 00:00:00 2001 From: tecnovert Date: Mon, 7 Oct 2024 20:44:09 +0200 Subject: [PATCH] tests: Add BSX_TEST_MODE env var to prepare script to manage all daemons by default. --- bin/basicswap_prepare.py | 4 +++- tests/basicswap/common_xmr.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/basicswap_prepare.py b/bin/basicswap_prepare.py index 1cee49d..2227cad 100755 --- a/bin/basicswap_prepare.py +++ b/bin/basicswap_prepare.py @@ -140,6 +140,7 @@ if not len(logger.handlers): logger.addHandler(logging.StreamHandler(sys.stdout)) BSX_DOCKER_MODE = toBool(os.getenv('BSX_DOCKER_MODE', 'false')) +BSX_TEST_MODE = toBool(os.getenv('BSX_TEST_MODE', 'false')) UI_HTML_PORT = int(os.getenv('UI_HTML_PORT', 12700)) UI_WS_PORT = int(os.getenv('UI_WS_PORT', 11700)) COINS_RPCBIND_IP = os.getenv('COINS_RPCBIND_IP', '127.0.0.1') @@ -276,7 +277,8 @@ def shouldManageDaemon(prefix: str) -> bool: The COIN _MANAGE_DAEMON variables can override this and set manage_daemon directly. If BSX_DOCKER_MODE is active COIN _MANAGE_DAEMON will default to false. ''' - manage_daemon: str = os.getenv(prefix + '_MANAGE_DAEMON', 'false' if BSX_DOCKER_MODE else 'auto') + default_mode: str = 'false' if BSX_DOCKER_MODE else 'true' if BSX_TEST_MODE else 'auto' + manage_daemon: str = os.getenv(prefix + '_MANAGE_DAEMON', default_mode) if manage_daemon == 'auto': host_was_set: bool = prefix + '_RPC_HOST' in os.environ diff --git a/tests/basicswap/common_xmr.py b/tests/basicswap/common_xmr.py index a26f716..3b57f16 100644 --- a/tests/basicswap/common_xmr.py +++ b/tests/basicswap/common_xmr.py @@ -92,6 +92,7 @@ def recursive_update_dict(base, new_vals): def run_prepare(node_id, datadir_path, bins_path, with_coins, mnemonic_in=None, num_nodes=3, use_rpcauth=False, extra_settings={}, port_ofs=0): config_path = os.path.join(datadir_path, cfg.CONFIG_FILENAME) + os.environ['BSX_TEST_MODE'] = 'true' os.environ['PART_RPC_PORT'] = str(PARTICL_RPC_PORT_BASE) os.environ['BTC_RPC_PORT'] = str(BITCOIN_RPC_PORT_BASE) os.environ['LTC_RPC_PORT'] = str(LITECOIN_RPC_PORT_BASE)