From 1485c596e732923d2a10fc1d5fa7a143eefee81a Mon Sep 17 00:00:00 2001 From: Alfredo Garcia Date: Tue, 10 Mar 2020 14:13:35 -0300 Subject: [PATCH] add stop_node argument to check_node_log, use it in shieldingcoinbase --- qa/rpc-tests/test_framework/util.py | 7 ++++--- qa/rpc-tests/turnstile.py | 6 ++---- qa/rpc-tests/wallet_shieldingcoinbase.py | 17 ++++++----------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/qa/rpc-tests/test_framework/util.py b/qa/rpc-tests/test_framework/util.py index 8c64633e0..518d8b4c3 100644 --- a/qa/rpc-tests/test_framework/util.py +++ b/qa/rpc-tests/test_framework/util.py @@ -495,10 +495,11 @@ def get_coinbase_address(node, expected_utxos=None): assert(len(addrs) > 0) return addrs[0] -def check_node_log(self, node_number, line_to_check): +def check_node_log(self, node_number, line_to_check, stop_node = True): print("Checking node " + str(node_number) + " logs") - self.nodes[node_number].stop() - bitcoind_processes[node_number].wait() + if stop_node: + self.nodes[node_number].stop() + bitcoind_processes[node_number].wait() logpath = self.options.tmpdir + "/node" + str(node_number) + "/regtest/debug.log" foundErrorMsg = False with open(logpath, "r") as myfile: diff --git a/qa/rpc-tests/turnstile.py b/qa/rpc-tests/turnstile.py index 032bde476..06fdc0c80 100755 --- a/qa/rpc-tests/turnstile.py +++ b/qa/rpc-tests/turnstile.py @@ -166,10 +166,8 @@ class TurnstileTest (BitcoinTestFramework): string_to_find1 = "ConnectBlock(): turnstile violation in " + POOL_NAME.capitalize() + " shielded value pool" string_to_find2 = "InvalidChainFound: invalid block=" string_to_find3 = "ConnectTip(): ConnectBlock " + newhash + " failed" - check_node_log(self, 0, string_to_find1) - self.start_and_sync_node(0) - check_node_log(self, 0, string_to_find2) - self.start_and_sync_node(0) + check_node_log(self, 0, string_to_find1, False) + check_node_log(self, 0, string_to_find2, False) check_node_log(self, 0, string_to_find3) self.start_and_sync_node(0) diff --git a/qa/rpc-tests/wallet_shieldingcoinbase.py b/qa/rpc-tests/wallet_shieldingcoinbase.py index 2181f9209..5cfaec227 100755 --- a/qa/rpc-tests/wallet_shieldingcoinbase.py +++ b/qa/rpc-tests/wallet_shieldingcoinbase.py @@ -8,7 +8,8 @@ from test_framework.authproxy import JSONRPCException from test_framework.mininode import COIN from test_framework.util import assert_equal, initialize_chain_clean, \ start_nodes, connect_nodes_bi, wait_and_assert_operationid_status, \ - wait_and_assert_operationid_status_result, get_coinbase_address + wait_and_assert_operationid_status_result, get_coinbase_address, \ + check_node_log import sys import timeit @@ -153,17 +154,11 @@ class WalletShieldingCoinbaseTest (BitcoinTestFramework): assert_equal("Invalid parameter, spending key for address does not belong to wallet" in errorString, True) # Verify that debug=zrpcunsafe logs params, and that full txid is associated with opid - logpath = self.options.tmpdir+"/node0/regtest/debug.log" logcounter = 0 - with open(logpath, "r") as myfile: - logdata = myfile.readlines() - for logline in logdata: - if myopid + ": z_sendmany initialized" in logline and mytaddr in logline and myzaddr in logline: - assert_equal(logcounter, 0) # verify order of log messages - logcounter = logcounter + 1 - if myopid + ": z_sendmany finished" in logline and mytxid in logline: - assert_equal(logcounter, 1) - logcounter = logcounter + 1 + check_node_log(self, 0, myopid + ": z_sendmany initialized", False) + logcounter = logcounter + 1 + check_node_log(self, 0, myopid + ": z_sendmany finished", False) + logcounter = logcounter + 1 assert_equal(logcounter, 2) # check balances (the z_sendmany consumes 3 coinbase utxos)