fix intermittent failure in test
@@ -35,12 +35,13 @@ def test_catchup_with_one_slow_node(tdir, tconf,
logsearch):
'''
1. Stop the node Delta
- 2. Order 9 txns. In sending CatchupReq in a first round every
- node [Alpha, Beta, Gamma] will receive request for 3 txns.
+ 2. Order 9 txns.
+ 3. Stop node Gamma
+ 4. Make Alpha don't respond to CatchupReqs
3. Start Delta
- 4. Make sure Consistency Proof is received from all 3 nodes (to send CatchupReq to all 3 nodes)
5. Check that all nodes have equality data.
6. Check that Delta re-ask CatchupRep only once.
+
In the second CatchupRep (first re-ask) Delta shouldn't request
CatchupRep from Alpha because it didn't answer early.
If the behavior is wrong and Delta re-ask txns form all nodes,
@@ -49,10 +50,12 @@ def test_catchup_with_one_slow_node(tdir, tconf,
'''
# Prepare nodes
lagging_node = txnPoolNodeSet[-1]
- rest_nodes = txnPoolNodeSet[:-1]
+ non_lagging_nodes = txnPoolNodeSet[:-1]
+ stopped_node = txnPoolNodeSet[-2]
+ non_stopped_nodes = txnPoolNodeSet[:-2]
- # Stop one node
- waitNodeDataEquality(looper, lagging_node, *rest_nodes)
+ # Stop Delta
+ waitNodeDataEquality(looper, lagging_node, *non_lagging_nodes)
disconnect_node_and_ensure_disconnected(looper,
txnPoolNodeSet,
lagging_node,
@@ -61,8 +64,15 @@ def test_catchup_with_one_slow_node(tdir, tconf,
# Send more requests to active nodes
sdk_send_random_and_check(looper, txnPoolNodeSet, sdk_pool_handle,
- sdk_wallet_client, len(rest_nodes) * 3)
- waitNodeDataEquality(looper, *rest_nodes)
+ sdk_wallet_client, len(non_lagging_nodes) * 3)
+ waitNodeDataEquality(looper, *non_lagging_nodes)
+
+ # Stop Gamma
+ disconnect_node_and_ensure_disconnected(looper,
+ txnPoolNodeSet,
+ stopped_node,
+ stopNode=True)
+ looper.removeProdable(stopped_node)
# Restart stopped node and wait for successful catch up
lagging_node = start_stopped_node(lagging_node,
@@ -76,16 +86,10 @@ def test_catchup_with_one_slow_node(tdir, tconf,
old_re_ask_count = len(log_re_ask)
# Delay CatchupRep messages on Alpha
- with delay_rules(rest_nodes[0].nodeIbStasher, cqDelay()):
- with delay_rules(lagging_node.nodeIbStasher, cpDelay()):
+ with delay_rules(non_stopped_nodes[0].nodeIbStasher, cqDelay()):
looper.add(lagging_node)
txnPoolNodeSet[-1] = lagging_node
- looper.run(checkNodesConnected(txnPoolNodeSet))
- # wait till we got consistency proofs from all nodes
- looper.run(
- eventually(lambda: assertExp(lagging_node.nodeIbStasher.num_of_stashed(ConsistencyProof) >= 3), retryWait=1,
- timeout=60))
- waitNodeDataEquality(looper, *txnPoolNodeSet, customTimeout=120,
+ waitNodeDataEquality(looper, lagging_node, *non_stopped_nodes, customTimeout=120,
exclude_from_check=['check_last_ordered_3pc_backup'])
assert len(log_re_ask) - old_re_ask_count == 2 # for audit and domain ledgers
