fix zstack reconnection test
import pytest
+from plenum.test.node_catchup.helper import ensure_all_nodes_have_same_data
from stp_core.common.log import getlogger
from stp_core.loop.eventually import eventually
from plenum.test.pool_transactions.conftest import looper, clientAndWallet1, \
client1, wallet1, client1Connected
-from plenum.test.helper import sendReqsToNodesAndVerifySuffReplies, stopNodes
+from plenum.test.helper import sendReqsToNodesAndVerifySuffReplies, stopNodes, send_reqs_to_nodes_and_verify_all_replies
from plenum.test.test_node import TestNode, ensureElectionsDone
logger = getlogger()
@@ -18,20 +19,6 @@ def tconf(conf, tdirWithPoolTxns):
conf.UseZStack = True
return conf
-
-def checkNodesSendingCommits(nodeSet):
- for node in nodeSet:
- for r in node.replicas:
- i = r.instId
- commitSenders = [_.voters for _ in r.commits.values()]
- for otherNode in nodeSet:
- if node == otherNode:
- continue
- otherReplica = otherNode.replicas[i]
- for senders in commitSenders:
- assert otherReplica.name in senders
-
-
def testZStackNodeReconnection(tconf, looper, txnPoolNodeSet, client1, wallet1,
tdirWithPoolTxns, client1Connected):
sendReqsToNodesAndVerifySuffReplies(looper, wallet1, client1, 1)
@@ -56,14 +43,16 @@ def testZStackNodeReconnection(tconf, looper, txnPoolNodeSet, client1, wallet1,
stopNodes([nodeToCrash], looper)
# TODO Select or create the timeout from 'waits'. Don't use constant.
looper.run(eventually(checkFlakyConnected, False, retryWait=1, timeout=60))
+
looper.runFor(1)
node = TestNode(nodeToCrash.name, basedirpath=tdirWithPoolTxns, config=tconf,
ha=nodeToCrash.nodestack.ha, cliha=nodeToCrash.clientstack.ha)
looper.add(node)
txnPoolNodeSet[idxToCrash] = node
+
# TODO Select or create the timeout from 'waits'. Don't use constant.
looper.run(eventually(checkFlakyConnected, True, retryWait=2, timeout=50))
- # TODO Select or create the timeout from 'waits'. Don't use constant.
- ensureElectionsDone(looper, txnPoolNodeSet, retryWait=2, customTimeout=50)
- sendReqsToNodesAndVerifySuffReplies(looper, wallet1, client1, 1)
- checkNodesSendingCommits(txnPoolNodeSet)
+ ensureElectionsDone(looper, txnPoolNodeSet, retryWait=2)
+ ensure_all_nodes_have_same_data(looper, nodes=txnPoolNodeSet)
+
+ send_reqs_to_nodes_and_verify_all_replies(looper, wallet1, client1, 10)
