mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-13 22:24:05 +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.
This commit is contained in:
@@ -139,13 +139,13 @@ class BlockchainTest(BitcoinTestFramework):
|
||||
self.nodes[0].generate(6)
|
||||
assert_equal(self.nodes[0].getblockcount(), 206)
|
||||
self.log.debug('Node should not stop at this height')
|
||||
assert_raises(subprocess.TimeoutExpired, lambda: self.bitcoind_processes[0].wait(timeout=3))
|
||||
assert_raises(subprocess.TimeoutExpired, lambda: self.nodes[0].process.wait(timeout=3))
|
||||
try:
|
||||
self.nodes[0].generate(1)
|
||||
except (ConnectionError, http.client.BadStatusLine):
|
||||
pass # The node already shut down before response
|
||||
self.log.debug('Node should stop at this height...')
|
||||
self.bitcoind_processes[0].wait(timeout=BITCOIND_PROC_WAIT_TIMEOUT)
|
||||
self.nodes[0].process.wait(timeout=BITCOIND_PROC_WAIT_TIMEOUT)
|
||||
self.nodes[0] = self.start_node(0, self.options.tmpdir)
|
||||
assert_equal(self.nodes[0].getblockcount(), 207)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user