mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-26 17:19:29 +01:00
[tests] Introduce TestNode
TestNode is a class responsible for all state related to a bitcoind node
under test. It stores local state, is responsible for tracking the
bitcoind process and delegates unrecognised messages to the RPC
connection.
This commit changes start_nodes and stop_nodes to start and stop the
bitcoind nodes in parallel, making test setup and teardown much faster.
Github-Pull: #10711
Rebased-From: 7897338918
This commit is contained in:
@@ -37,7 +37,7 @@ class RPCBindTest(BitcoinTestFramework):
|
||||
base_args += ['-rpcallowip=' + x for x in allow_ips]
|
||||
binds = ['-rpcbind='+addr for addr in addresses]
|
||||
self.nodes = self.start_nodes(self.num_nodes, self.options.tmpdir, [base_args + binds], connect_to)
|
||||
pid = self.bitcoind_processes[0].pid
|
||||
pid = self.nodes[0].process.pid
|
||||
assert_equal(set(get_bind_addrs(pid)), set(expected))
|
||||
self.stop_nodes()
|
||||
|
||||
@@ -49,7 +49,7 @@ class RPCBindTest(BitcoinTestFramework):
|
||||
base_args = ['-disablewallet', '-nolisten'] + ['-rpcallowip='+x for x in allow_ips]
|
||||
self.nodes = self.start_nodes(self.num_nodes, self.options.tmpdir, [base_args])
|
||||
# connect to node through non-loopback interface
|
||||
node = get_rpc_proxy(rpc_url(get_datadir_path(self.options.tmpdir, 0), 0, "%s:%d" % (rpchost, rpcport)), 0)
|
||||
node = get_rpc_proxy(rpc_url(get_datadir_path(self.options.tmpdir, 0), 0, "%s:%d" % (rpchost, rpcport)), 0, coveragedir=self.options.coveragedir)
|
||||
node.getnetworkinfo()
|
||||
self.stop_nodes()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user