preserve test semantics

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
Alfredo Garcia 2020-03-18 19:34:32 -03:00
parent 1485c596e7
commit 2707e6ff6c
3 changed files with 8 additions and 13 deletions

View File

@ -501,11 +501,9 @@ def check_node_log(self, node_number, line_to_check, stop_node = True):
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:
logdata = myfile.readlines()
for logline in logdata:
for (n, logline) in enumerate(logdata):
if line_to_check in logline:
foundErrorMsg = True
break
assert(foundErrorMsg)
return n
raise AssertionError(repr(line_to_check) + " not found")

View File

@ -166,9 +166,9 @@ 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, False)
check_node_log(self, 0, string_to_find1, True)
check_node_log(self, 0, string_to_find2, False)
check_node_log(self, 0, string_to_find3)
check_node_log(self, 0, string_to_find3, False)
self.start_and_sync_node(0)
assert_equal(newhash, self.nodes[0].getbestblockhash())

View File

@ -154,12 +154,9 @@ 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
logcounter = 0
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)
initialized_line = check_node_log(self, 0, myopid + ": z_sendmany initialized", False)
finished_line = check_node_log(self, 0, myopid + ": z_sendmany finished", False)
assert(initialized_line < finished_line)
# check balances (the z_sendmany consumes 3 coinbase utxos)
resp = self.nodes[0].z_gettotalbalance()