Skip to content

Commit

Permalink
[qa] util: Move wait_bitcoinds() into stop_nodes()
Browse files Browse the repository at this point in the history
Github-Pull: #8860
Rebased-From: fa7c35c4ec630838178b4674288da33561a66f08
  • Loading branch information
MarcoFalke committed Oct 3, 2016
1 parent 794b007 commit 0bee740
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 23 deletions.
1 change: 0 additions & 1 deletion qa/rpc-tests/bip9-softforks.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ def test_BIP(self, bipName, activated_version, invalidate, invalidatePostSignatu
# Restart all
self.test.block_store.close()
stop_nodes(self.nodes)
wait_bitcoinds()
shutil.rmtree(self.options.tmpdir)
self.setup_chain()
self.setup_network()
Expand Down
1 change: 0 additions & 1 deletion qa/rpc-tests/fundrawtransaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,6 @@ def run_test(self):
self.nodes[1].encryptwallet("test")
self.nodes.pop(1)
stop_nodes(self.nodes)
wait_bitcoinds()

self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
# This test is not meant to test fee estimation and we'd like
Expand Down
6 changes: 2 additions & 4 deletions qa/rpc-tests/p2p-versionbits-warning.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ def run_test(self):
# is cleared, and restart the node. This should move the versionbit state
# to ACTIVE.
self.nodes[0].generate(VB_PERIOD)
stop_node(self.nodes[0], 0)
wait_bitcoinds()
stop_nodes(self.nodes)
# Empty out the alert file
with open(self.alert_filename, 'w') as _:
pass
Expand All @@ -156,8 +155,7 @@ def run_test(self):
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].getnetworkinfo()["warnings"])
stop_node(self.nodes[0], 0)
wait_bitcoinds()
stop_nodes(self.nodes)
self.test_versionbits_in_alert_file()

# Test framework expects the node to still be running...
Expand Down
16 changes: 9 additions & 7 deletions qa/rpc-tests/reindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
# Test -reindex and -reindex-chainstate with CheckBlockIndex
#
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

class ReindexTest(BitcoinTestFramework):
Expand All @@ -18,16 +22,14 @@ def __init__(self):
self.num_nodes = 1

def setup_network(self):
self.nodes = []
self.is_network_split = False
self.nodes.append(start_node(0, self.options.tmpdir))
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)

def reindex(self, justchainstate=False):
self.nodes[0].generate(3)
blockcount = self.nodes[0].getblockcount()
stop_node(self.nodes[0], 0)
wait_bitcoinds()
self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug", "-reindex-chainstate" if justchainstate else "-reindex", "-checkblockindex=1"])
stop_nodes(self.nodes)
extra_args = [["-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:
time.sleep(0.1)
assert_equal(self.nodes[0].getblockcount(), blockcount)
Expand Down
2 changes: 0 additions & 2 deletions qa/rpc-tests/rpcbind_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def run_bind_test(self, allow_ips, connect_to, addresses, expected):
assert_equal(set(get_bind_addrs(pid)), set(expected))
finally:
stop_nodes(self.nodes)
wait_bitcoinds()

def run_allowip_test(self, allow_ips, rpchost, rpcport):
'''
Expand All @@ -58,7 +57,6 @@ def run_allowip_test(self, allow_ips, rpchost, rpcport):
finally:
node = None # make sure connection will be garbage collected and closed
stop_nodes(self.nodes)
wait_bitcoinds()

def run_test(self):
# due to OS-specific network stats queries, this test works only on Linux
Expand Down
4 changes: 0 additions & 4 deletions qa/rpc-tests/test_framework/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
sync_mempools,
stop_nodes,
stop_node,
wait_bitcoinds,
enable_coverage,
check_json_precision,
initialize_chain_clean,
Expand Down Expand Up @@ -81,7 +80,6 @@ def split_network(self):
"""
assert not self.is_network_split
stop_nodes(self.nodes)
wait_bitcoinds()
self.setup_network(True)

def sync_all(self):
Expand All @@ -100,7 +98,6 @@ def join_network(self):
"""
assert self.is_network_split
stop_nodes(self.nodes)
wait_bitcoinds()
self.setup_network(False)

def main(self):
Expand Down Expand Up @@ -168,7 +165,6 @@ def main(self):
if not self.options.noshutdown:
print("Stopping nodes")
stop_nodes(self.nodes)
wait_bitcoinds()
else:
print("Note: bitcoinds were not stopped and may still be running")

Expand Down
2 changes: 1 addition & 1 deletion qa/rpc-tests/test_framework/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ def initialize_chain(test_dir, num_nodes):

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

def set_node_times(nodes, t):
for node in nodes:
Expand Down
3 changes: 0 additions & 3 deletions qa/rpc-tests/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ def run_test (self):

#do some -walletbroadcast tests
stop_nodes(self.nodes)
wait_bitcoinds()
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,1,2)
Expand All @@ -225,7 +224,6 @@ def run_test (self):

#restart the nodes with -walletbroadcast=1
stop_nodes(self.nodes)
wait_bitcoinds()
self.nodes = start_nodes(3, self.options.tmpdir)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
Expand Down Expand Up @@ -335,7 +333,6 @@ def run_test (self):
for m in maintenance:
print("check " + m)
stop_nodes(self.nodes)
wait_bitcoinds()
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)]:
# reindex will leave rpc warm up "early"; Wait for it to finish
Expand Down

0 comments on commit 0bee740

Please sign in to comment.