Browse Source

[qa] util: Move wait_bitcoinds() into stop_nodes()

0.14
MarcoFalke 8 years ago
parent
commit
fa7c35c4ec
  1. 1
      qa/rpc-tests/bip9-softforks.py
  2. 1
      qa/rpc-tests/fundrawtransaction.py
  3. 6
      qa/rpc-tests/p2p-versionbits-warning.py
  4. 16
      qa/rpc-tests/reindex.py
  5. 2
      qa/rpc-tests/rpcbind_test.py
  6. 4
      qa/rpc-tests/test_framework/test_framework.py
  7. 2
      qa/rpc-tests/test_framework/util.py
  8. 3
      qa/rpc-tests/wallet.py

1
qa/rpc-tests/bip9-softforks.py

@ -195,7 +195,6 @@ class BIP9SoftForksTest(ComparisonTestFramework):
# Restart all # Restart all
self.test.block_store.close() self.test.block_store.close()
stop_nodes(self.nodes) stop_nodes(self.nodes)
wait_bitcoinds()
shutil.rmtree(self.options.tmpdir) shutil.rmtree(self.options.tmpdir)
self.setup_chain() self.setup_chain()
self.setup_network() self.setup_network()

1
qa/rpc-tests/fundrawtransaction.py

@ -470,7 +470,6 @@ class RawTransactionsTest(BitcoinTestFramework):
self.nodes[1].encryptwallet("test") self.nodes[1].encryptwallet("test")
self.nodes.pop(1) self.nodes.pop(1)
stop_nodes(self.nodes) stop_nodes(self.nodes)
wait_bitcoinds()
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir) self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
# This test is not meant to test fee estimation and we'd like # This test is not meant to test fee estimation and we'd like

6
qa/rpc-tests/p2p-versionbits-warning.py

@ -144,8 +144,7 @@ class VersionBitsWarningTest(BitcoinTestFramework):
# is cleared, and restart the node. This should move the versionbit state # is cleared, and restart the node. This should move the versionbit state
# to ACTIVE. # to ACTIVE.
self.nodes[0].generate(VB_PERIOD) self.nodes[0].generate(VB_PERIOD)
stop_node(self.nodes[0], 0) stop_nodes(self.nodes)
wait_bitcoinds()
# Empty out the alert file # Empty out the alert file
with open(self.alert_filename, 'w', encoding='utf8') as _: with open(self.alert_filename, 'w', encoding='utf8') as _:
pass pass
@ -156,8 +155,7 @@ class VersionBitsWarningTest(BitcoinTestFramework):
assert(WARN_UNKNOWN_RULES_ACTIVE in self.nodes[0].getinfo()["errors"]) assert(WARN_UNKNOWN_RULES_ACTIVE in self.nodes[0].getinfo()["errors"])
assert(WARN_UNKNOWN_RULES_ACTIVE in self.nodes[0].getmininginfo()["errors"]) assert(WARN_UNKNOWN_RULES_ACTIVE in self.nodes[0].getmininginfo()["errors"])
assert(WARN_UNKNOWN_RULES_ACTIVE in self.nodes[0].getnetworkinfo()["warnings"]) assert(WARN_UNKNOWN_RULES_ACTIVE in self.nodes[0].getnetworkinfo()["warnings"])
stop_node(self.nodes[0], 0) stop_nodes(self.nodes)
wait_bitcoinds()
self.test_versionbits_in_alert_file() self.test_versionbits_in_alert_file()
# Test framework expects the node to still be running... # Test framework expects the node to still be running...

16
qa/rpc-tests/reindex.py

@ -7,7 +7,11 @@
# Test -reindex and -reindex-chainstate with CheckBlockIndex # Test -reindex and -reindex-chainstate with CheckBlockIndex
# #
from test_framework.test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import * from test_framework.util import (
start_nodes,
stop_nodes,
assert_equal,
)
import time import time
class ReindexTest(BitcoinTestFramework): class ReindexTest(BitcoinTestFramework):
@ -18,16 +22,14 @@ class ReindexTest(BitcoinTestFramework):
self.num_nodes = 1 self.num_nodes = 1
def setup_network(self): def setup_network(self):
self.nodes = [] self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
self.is_network_split = False
self.nodes.append(start_node(0, self.options.tmpdir))
def reindex(self, justchainstate=False): def reindex(self, justchainstate=False):
self.nodes[0].generate(3) self.nodes[0].generate(3)
blockcount = self.nodes[0].getblockcount() blockcount = self.nodes[0].getblockcount()
stop_node(self.nodes[0], 0) stop_nodes(self.nodes)
wait_bitcoinds() extra_args = [["-debug", "-reindex-chainstate" if justchainstate else "-reindex", "-checkblockindex=1"]]
self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug", "-reindex-chainstate" if justchainstate else "-reindex", "-checkblockindex=1"]) self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args)
while self.nodes[0].getblockcount() < blockcount: while self.nodes[0].getblockcount() < blockcount:
time.sleep(0.1) time.sleep(0.1)
assert_equal(self.nodes[0].getblockcount(), blockcount) assert_equal(self.nodes[0].getblockcount(), blockcount)

2
qa/rpc-tests/rpcbind_test.py

@ -40,7 +40,6 @@ class RPCBindTest(BitcoinTestFramework):
assert_equal(set(get_bind_addrs(pid)), set(expected)) assert_equal(set(get_bind_addrs(pid)), set(expected))
finally: finally:
stop_nodes(self.nodes) stop_nodes(self.nodes)
wait_bitcoinds()
def run_allowip_test(self, allow_ips, rpchost, rpcport): def run_allowip_test(self, allow_ips, rpchost, rpcport):
''' '''
@ -56,7 +55,6 @@ class RPCBindTest(BitcoinTestFramework):
finally: finally:
node = None # make sure connection will be garbage collected and closed node = None # make sure connection will be garbage collected and closed
stop_nodes(self.nodes) stop_nodes(self.nodes)
wait_bitcoinds()
def run_test(self): def run_test(self):
# due to OS-specific network stats queries, this test works only on Linux # due to OS-specific network stats queries, this test works only on Linux

4
qa/rpc-tests/test_framework/test_framework.py

@ -21,7 +21,6 @@ from .util import (
sync_mempools, sync_mempools,
stop_nodes, stop_nodes,
stop_node, stop_node,
wait_bitcoinds,
enable_coverage, enable_coverage,
check_json_precision, check_json_precision,
initialize_chain_clean, initialize_chain_clean,
@ -81,7 +80,6 @@ class BitcoinTestFramework(object):
""" """
assert not self.is_network_split assert not self.is_network_split
stop_nodes(self.nodes) stop_nodes(self.nodes)
wait_bitcoinds()
self.setup_network(True) self.setup_network(True)
def sync_all(self): def sync_all(self):
@ -100,7 +98,6 @@ class BitcoinTestFramework(object):
""" """
assert self.is_network_split assert self.is_network_split
stop_nodes(self.nodes) stop_nodes(self.nodes)
wait_bitcoinds()
self.setup_network(False) self.setup_network(False)
def main(self): def main(self):
@ -170,7 +167,6 @@ class BitcoinTestFramework(object):
if not self.options.noshutdown: if not self.options.noshutdown:
print("Stopping nodes") print("Stopping nodes")
stop_nodes(self.nodes) stop_nodes(self.nodes)
wait_bitcoinds()
else: else:
print("Note: bitcoinds were not stopped and may still be running") print("Note: bitcoinds were not stopped and may still be running")

2
qa/rpc-tests/test_framework/util.py

@ -266,7 +266,6 @@ def initialize_chain(test_dir, num_nodes, cachedir):
# Shut them down, and clean up cache directories: # Shut them down, and clean up cache directories:
stop_nodes(rpcs) stop_nodes(rpcs)
wait_bitcoinds()
disable_mocktime() disable_mocktime()
for i in range(MAX_NODES): for i in range(MAX_NODES):
os.remove(log_filename(cachedir, i, "debug.log")) os.remove(log_filename(cachedir, i, "debug.log"))
@ -365,6 +364,7 @@ def stop_nodes(nodes):
except http.client.CannotSendRequest as e: except http.client.CannotSendRequest as e:
print("WARN: Unable to stop node: " + repr(e)) print("WARN: Unable to stop node: " + repr(e))
del nodes[:] # Emptying array closes connections as a side effect del nodes[:] # Emptying array closes connections as a side effect
wait_bitcoinds()
def set_node_times(nodes, t): def set_node_times(nodes, t):
for node in nodes: for node in nodes:

3
qa/rpc-tests/wallet.py

@ -199,7 +199,6 @@ class WalletTest (BitcoinTestFramework):
#do some -walletbroadcast tests #do some -walletbroadcast tests
stop_nodes(self.nodes) stop_nodes(self.nodes)
wait_bitcoinds()
self.nodes = start_nodes(3, self.options.tmpdir, [["-walletbroadcast=0"],["-walletbroadcast=0"],["-walletbroadcast=0"]]) self.nodes = start_nodes(3, self.options.tmpdir, [["-walletbroadcast=0"],["-walletbroadcast=0"],["-walletbroadcast=0"]])
connect_nodes_bi(self.nodes,0,1) connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2) connect_nodes_bi(self.nodes,1,2)
@ -225,7 +224,6 @@ class WalletTest (BitcoinTestFramework):
#restart the nodes with -walletbroadcast=1 #restart the nodes with -walletbroadcast=1
stop_nodes(self.nodes) stop_nodes(self.nodes)
wait_bitcoinds()
self.nodes = start_nodes(3, self.options.tmpdir) self.nodes = start_nodes(3, self.options.tmpdir)
connect_nodes_bi(self.nodes,0,1) connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2) connect_nodes_bi(self.nodes,1,2)
@ -335,7 +333,6 @@ class WalletTest (BitcoinTestFramework):
for m in maintenance: for m in maintenance:
print("check " + m) print("check " + m)
stop_nodes(self.nodes) stop_nodes(self.nodes)
wait_bitcoinds()
self.nodes = start_nodes(3, self.options.tmpdir, [[m]] * 3) self.nodes = start_nodes(3, self.options.tmpdir, [[m]] * 3)
while m == '-reindex' and [block_count] * 3 != [self.nodes[i].getblockcount() for i in range(3)]: while m == '-reindex' and [block_count] * 3 != [self.nodes[i].getblockcount() for i in range(3)]:
# reindex will leave rpc warm up "early"; Wait for it to finish # reindex will leave rpc warm up "early"; Wait for it to finish

Loading…
Cancel
Save