Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Cleanup logging statements. GH #4973
Browse files Browse the repository at this point in the history
  • Loading branch information
brianjohnson5972 committed Sep 10, 2018
1 parent 1a0eba2 commit f101c93
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 31 deletions.
7 changes: 0 additions & 7 deletions plugins/test_control_plugin/test_control_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,11 @@ void test_control_plugin_impl::process_next_block_state(const chain::block_heade
// start counting sequences for this producer (once we
if (producer_name == _producer && _clean_producer_sequence) {
_producer_sequence += 1;
wlog("test_control_plugin_impl::process_next_block_state() seq=${seq}",("seq",_producer_sequence));

if (_producer_sequence >= _where_in_sequence) {
app().quit();
}
} else if (producer_name != _producer) {
wlog("test_control_plugin_impl::process_next_block_state() reset");
_producer_sequence = -1;
// can now guarantee we are at the start of the producer
_clean_producer_sequence = true;
Expand Down Expand Up @@ -130,16 +128,11 @@ void test_control_plugin::plugin_shutdown() {

namespace test_control_apis {
read_write::kill_node_on_producer_results read_write::kill_node_on_producer(const read_write::kill_node_on_producer_params& params) const {
wlog("test_control_plugin::kill_node_on_producer() ${prod} ${where_in_seq} ${head_lib}",("prod",params.producer.to_string())("where_in_seq",params.where_in_sequence)("head_lib", (params.based_on_lib ? "LIB" : "HEAD")));

if (params.based_on_lib) {
wlog("test_control_plugin::kill_node_on_producer() kill_on_lib");
my->kill_on_lib(params.producer, params.where_in_sequence);
wlog("test_control_plugin::kill_node_on_producer() kill_on_lib done");
} else {
wlog("test_control_plugin::kill_node_on_producer() kill_on_head");
my->kill_on_head(params.producer, params.where_in_sequence);
wlog("test_control_plugin::kill_node_on_producer() kill_on_head done");
}
return read_write::kill_node_on_producer_results{};
}
Expand Down
2 changes: 0 additions & 2 deletions tests/TestHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def __init__(self, flag, type, help, default, choices=None):
def add(self, flag, type, help, default, choices=None):
arg=self.AppArg(flag, type, help, default, choices)
self.args.append(arg)
Utils.Print("args %d" % (len(self.args)))

# pylint: disable=too-many-instance-attributes
class TestHelper(object):
Expand All @@ -36,7 +35,6 @@ def parse_args(includeArgs, applicationSpecificArgs=AppArgs()):
assert(includeArgs)
assert(isinstance(includeArgs, set))
assert(isinstance(applicationSpecificArgs, AppArgs))
Utils.Print("applicationSpecificArgs %d" % (len(applicationSpecificArgs.args)))

parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('-?', action='help', default=argparse.SUPPRESS,
Expand Down
33 changes: 11 additions & 22 deletions tests/nodeos_forked_chain_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,14 @@

Print("Wallet \"%s\" password=%s." % (testWalletName, testWallet.password.encode("utf-8")))

def printNode(node, msg=None):
if msg is None:
msg=""
else:
msg+=" "
Utils.Print("%sNode host=%s, port=%s, pid=%s" % (msg, node.host, node.port, node.pid))

nonProdNode=None
prodNodes=[]
producers=[]
for i in range(0, totalNodes):
node=cluster.getNode(i)
node.producers=Cluster.parseProducers(i)
numProducers=len(node.producers)
Utils.Print("node has producers=%s" % (node.producers))
Print("node has producers=%s" % (node.producers))
if numProducers==0:
if nonProdNode is None:
nonProdNode=node
Expand All @@ -132,18 +125,18 @@ def printNode(node, msg=None):
trans=node.delegatebw(account, 20000000.0000, 20000000.0000, exitOnError=True)

#verify nodes are in sync and advancing
cluster.waitOnClusterSync(blockAdvancing=5)
cluster.waitOnClusterSync(blockAdvancing=5)
index=0
for account in accounts:
Utils.Print("vote for producers=%s" % (producers))
Print("Vote for producers=%s" % (producers))
trans=prodNodes[index % len(prodNodes)].vote(account, producers)
index+=1

#verify nodes are in sync and advancing
cluster.waitOnClusterSync(blockAdvancing=5)
cluster.waitOnClusterSync(blockAdvancing=5)
blockNum=node.getNextCleanProductionCycle(trans)
blockProducer=node.getBlockProducerByNum(blockNum)
Utils.Print("Validating blockNum=%s, producer=%s" % (blockNum, blockProducer))
Print("Validating blockNum=%s, producer=%s" % (blockNum, blockProducer))
cluster.biosNode.kill(signal.SIGTERM)

lastBlockProducer=blockProducer
Expand Down Expand Up @@ -184,14 +177,14 @@ def printNode(node, msg=None):
else:
output+=", "
output+=blockProducer+":"+str(producerToSlot[blockProducer]["count"])
Utils.Print("ProductionCycle ->> {\n%s\n}" % output)
Print("ProductionCycle ->> {\n%s\n}" % output)

for prodNode in prodNodes:
prodNode.getInfo()

cluster.reportStatus()

Utils.Print("Sending command to kill \"bridge\" node to separate the 2 producer groups.")
Print("Sending command to kill \"bridge\" node to separate the 2 producer groups.")
# block number to start expecting node killed after
preKillBlockNum=nonProdNode.getBlockNum()
preKillBlockProducer=nonProdNode.getBlockProducerByNum(preKillBlockNum)
Expand All @@ -207,7 +200,6 @@ def printNode(node, msg=None):
libs0=[]
libs1=[]
lastBlockNum=max([preKillBlockNum,postKillBlockNum])+maxActiveProducers*inRowCountPerProducer
Utils.Print("preKillBlockNum=%s, postKillBlockNum=%s, lastBlockNum=%d" % (preKillBlockNum,postKillBlockNum,lastBlockNum))
actualLastBlockNum=None
prodChanged=False
nextProdChange=False
Expand All @@ -226,7 +218,6 @@ def printNode(node, msg=None):
blockProducer1=prodNodes[1].getBlockProducerByNum(blockNum)
blockProducers0.append({"blockNum":blockNum, "prod":blockProducer0})
blockProducers1.append({"blockNum":blockNum, "prod":blockProducer1})
#Utils.Print("blockProducer0=%s, blockProducer1=%s, blockNum=%d" % (blockProducer0,blockProducer1,blockNum))
# ensure that we wait for the next instance of killAtProducer
if not prodChanged:
if preKillBlockProducer!=blockProducer0:
Expand Down Expand Up @@ -297,15 +288,14 @@ def analyzeBPs(bps0, bps1, expectDivergence):
bpsStr0+=str(blockNum0)+numDiff+"->"+prod0+prodDiff
bpsStr1+=str(blockNum1)+numDiff+"->"+prod1+prodDiff
if printInfo:
Utils.Print("ERROR: Analyzing Block Producers, did not expect nodes to indicate different block producers for the same blocks.")
Utils.Print("Matchinb Blocks= %s" % (bpsStr))
Utils.Print("Diverging branch node0= %s" % (bpsStr0))
Utils.Print("Diverging branch node1= %s" % (bpsStr1))
Print("ERROR: Analyzing Block Producers, did not expect nodes to indicate different block producers for the same blocks.")
Print("Matching Blocks= %s" % (bpsStr))
Print("Diverging branch node0= %s" % (bpsStr0))
Print("Diverging branch node1= %s" % (bpsStr1))
return firstDivergence

firstDivergence=analyzeBPs(blockProducers0, blockProducers1, expectDivergence=True)
# Nodes should not have diverged till the last block
Utils.Print("firstDivergence=%s, blockNum=%s" % (firstDivergence, blockNum))
assert(firstDivergence==blockNum)
blockProducers0=[]
blockProducers1=[]
Expand All @@ -325,7 +315,6 @@ def analyzeBPs(bps0, bps1, expectDivergence):

info0=prodNodes[0].getInfo(blockNum)
info1=prodNodes[1].getInfo(blockNum)
Utils.Print("info0=%s\n\ninfo1=%s\n\n" % (info0, info1))
firstDivergence=analyzeBPs(blockProducers0, blockProducers1, expectDivergence=True)
assert(firstDivergence==killBlockNum)
blockProducers0=[]
Expand Down

0 comments on commit f101c93

Please sign in to comment.