From 7fc70f725a0a140bca3f4ae9d98f68b5e0c40222 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Mon, 5 Oct 2026 14:30:00 +0000 Subject: [PATCH] cmdtest.py remote: cleanups, add log test --- test/cmdtest_d/remote.py | 25 ++++++++++++++++++------- test/cmdtest_d/rune.py | 7 +++++-- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/test/cmdtest_d/remote.py b/test/cmdtest_d/remote.py index bbb67367..7be78277 100755 --- a/test/cmdtest_d/remote.py +++ b/test/cmdtest_d/remote.py @@ -28,6 +28,8 @@ class CmdTestRemote(CmdTestBase, CmdTestSwapMethods, CmdTestRuneMethods): ('health', 'checking health of THORChain network'), ('inbounds', 'getting inbound addresses (all coins)'), ('inbound_ltc', 'getting inbound address for LTC'), + ('inbound_ltc_log', 'getting inbound addresses (all coins, logging to file)'), + ('inbound_ltc_log_chk', 'checking log file'), ('lastblock', 'getting lastblock info'), ('lastblock_btc', 'getting lastblock info for BTC'), ('actions_addr', 'getting actions for address'), @@ -41,10 +43,10 @@ class CmdTestRemote(CmdTestBase, CmdTestSwapMethods, CmdTestRuneMethods): return self.start_thornode_servers() - def ping(self, *, asset=None): + def ping(self): return self._rune_remote('ping') - def health(self, *, asset=None): + def health(self): return self._rune_remote('health') def inbounds(self): @@ -53,19 +55,28 @@ class CmdTestRemote(CmdTestBase, CmdTestSwapMethods, CmdTestRuneMethods): def inbound_ltc(self): return self._rune_remote('inbound_addrs', ['coin=ltc']) - def lastblock(self, *, asset=None): + def inbound_ltc_log(self): + return self._rune_remote('inbound_addrs', ['coin=ltc'], add_opts=['--log']) + + def inbound_ltc_log_chk(self): + import json + self.spawn(msg_only=True) + json.loads(self.read_from_tmpfile('mmgen-remote-RUNE-inbound-addrs-coin=ltc.json')) + return 'ok' + + def lastblock(self): return self._rune_remote('lastblock') - def lastblock_btc(self, *, asset=None): + def lastblock_btc(self): return self._rune_remote('lastblock', ['coin=btc']) - def actions_addr(self, *, asset=None): + def actions_addr(self): return self._rune_remote('actions', ['addr=thor1abcdefg']) - def actions_txid(self, *, asset=None): + def actions_txid(self): return self._rune_remote('actions', ['txid=deadbeef']) - def actions_addr_txid(self, *, asset=None): + def actions_addr_txid(self): return self._rune_remote('actions', ['addr=thor1abcdefg', 'txid=deadbeef']) def stop_servers(self): diff --git a/test/cmdtest_d/rune.py b/test/cmdtest_d/rune.py index 9f7abba4..813c8892 100755 --- a/test/cmdtest_d/rune.py +++ b/test/cmdtest_d/rune.py @@ -77,10 +77,13 @@ class CmdTestRuneMethods: return 'ok' return t - def _rune_remote(self, cmd, cmd_args=(), color=True): + def _rune_remote(self, cmd, cmd_args=(), *, add_opts=[], color=True): return self.spawn( 'mmgen-remote', - ['--coin=rune', '--regtest=1', f'--color={int(color)}'] + [cmd] + list(cmd_args), + ['--coin=rune', '--regtest=1', f'--color={int(color)}', f'--outdir={self.tmpdir}'] + + add_opts + + [cmd] + + list(cmd_args), env = cleanup_env(self.cfg)) class CmdTestRune(CmdTestRuneMethods, CmdTestEthdevMethods, CmdTestBase, CmdTestShared):