diff --git a/test/cmdtest_d/ethdev.py b/test/cmdtest_d/ethdev.py index 3dabf975..b77a6823 100755 --- a/test/cmdtest_d/ethdev.py +++ b/test/cmdtest_d/ethdev.py @@ -744,7 +744,7 @@ class CmdTestEthdev(CmdTestEthdevMethods, CmdTestBase, CmdTestShared): self.message = 'attack at dawn' self.spawn_env['MMGEN_BOGUS_SEND'] = '' - TestProxy(cfg) + TestProxy(self, cfg) @property async def rpc(self): diff --git a/test/cmdtest_d/ethswap.py b/test/cmdtest_d/ethswap.py index 326804b3..e6a7dbcb 100755 --- a/test/cmdtest_d/ethswap.py +++ b/test/cmdtest_d/ethswap.py @@ -263,7 +263,7 @@ class CmdTestEthSwap(CmdTestSwapMethods, CmdTestRegtest): self.swap_server = ThornodeSwapServer() self.swap_server.start() - TestProxy(cfg) + TestProxy(self, cfg) def swaptxcreate1(self): t = self._swaptxcreate(['BTC', '8.765', 'ETH']) diff --git a/test/cmdtest_d/include/proxy.py b/test/cmdtest_d/include/proxy.py index 9f4585bf..81ef3100 100755 --- a/test/cmdtest_d/include/proxy.py +++ b/test/cmdtest_d/include/proxy.py @@ -55,16 +55,18 @@ class TestProxy: def kill_proxy(self, args): if sys.platform in ('linux', 'darwin'): - omsg(f'Killing SSH SOCKS server at localhost:{self.port}') + omsg(f'Stopping SSH SOCKS server at localhost:{self.port}') cmd = ['pkill', '-f', ' '.join(args)] run(cmd) - def __init__(self, cfg, external_call=False): + def __init__(self, test_group, cfg): + + if test_group and test_group.is_helper: + return def start_proxy(): - if external_call or not cfg.no_daemon_autostart: - run(a + b2) - omsg(f'SSH SOCKS server started, listening at localhost:{self.port}') + run(a + b2) + omsg(f'SSH SOCKS server started, listening at localhost:{self.port}') a = ['ssh', '-x', '-o', 'ExitOnForwardFailure=True', '-D', f'localhost:{self.port}'] b0 = ['-o', 'PasswordAuthentication=False'] @@ -89,6 +91,9 @@ class TestProxy: else: die(2, fmt(self.need_start_errmsg.format(' '.join(a + b2)), indent=' ')) - if not (external_call or cfg.no_daemon_stop): + if test_group is None: + self.kill_proxy(a + b2) + elif not hasattr(test_group.tr, 'proxy_stop_registered'): atexit.unregister(self.kill_proxy) atexit.register(self.kill_proxy, a + b2) + test_group.tr.proxy_stop_registered = True diff --git a/test/cmdtest_d/rune.py b/test/cmdtest_d/rune.py index 8dffe945..ac97779e 100755 --- a/test/cmdtest_d/rune.py +++ b/test/cmdtest_d/rune.py @@ -73,7 +73,7 @@ class CmdTestRune(CmdTestEthdevMethods, CmdTestBase, CmdTestShared): self.rpc_server = ThornodeRPCServer() self.rpc_server.start() - TestProxy(cfg) + TestProxy(self, cfg) self.txhex_file = f'{self.tmpdir}/tx_dump.hex' diff --git a/test/cmdtest_d/runeswap.py b/test/cmdtest_d/runeswap.py index be585b14..7ab05893 100755 --- a/test/cmdtest_d/runeswap.py +++ b/test/cmdtest_d/runeswap.py @@ -38,9 +38,9 @@ class CmdTestRuneSwap(CmdTestSwapMethods, CmdTestRegtest): ('subgroup.init', []), ('subgroup.rune_init', ['init']), ('subgroup.rune_swap', ['rune_init']), - ('stop', 'stopping the regtest daemon'), - ('swap_server_stop', 'stopping the Thornode swap server'), ('rune_rpc_server_stop', 'stopping the Thornode RPC server'), + ('swap_server_stop', 'stopping the Thornode swap server'), + ('stop', 'stopping the regtest daemon'), ) cmd_subgroups = { 'init': ( @@ -81,7 +81,7 @@ class CmdTestRuneSwap(CmdTestSwapMethods, CmdTestRegtest): self.swap_server = ThornodeSwapServer() self.swap_server.start() - TestProxy(cfg) + TestProxy(self, cfg) def swap_server_stop(self): return self._thornode_server_stop() diff --git a/test/cmdtest_d/xmrwallet.py b/test/cmdtest_d/xmrwallet.py index a9613e37..b5db39ca 100755 --- a/test/cmdtest_d/xmrwallet.py +++ b/test/cmdtest_d/xmrwallet.py @@ -140,7 +140,7 @@ class CmdTestXMRWallet(CmdTestBase): if os.path.exists(self.datadir_base): shutil.rmtree(self.datadir_base) os.makedirs(self.datadir_base) - TestProxy(cfg) + TestProxy(self, cfg) self.start_daemons() self.balance = None diff --git a/test/modtest_d/testdep.py b/test/modtest_d/testdep.py index d67a7e98..466dcc13 100755 --- a/test/modtest_d/testdep.py +++ b/test/modtest_d/testdep.py @@ -66,4 +66,4 @@ class unit_tests: def ssh_socks_proxy(self, name, ut): from test.cmdtest_d.include.proxy import TestProxy - return TestProxy(cfg, external_call=True) + return TestProxy(None, cfg)