-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added another test scenario for catchup (#178)
- Loading branch information
1 parent
078acc8
commit 50b52c7
Showing
4 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
plenum/test/node_catchup/test_node_catchup_after_lost_connection.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from stp_core.common.log import getlogger | ||
from plenum.test.test_node import ensure_node_disconnected | ||
from plenum.test.helper import sendReqsToNodesAndVerifySuffReplies | ||
from plenum.test.node_catchup.helper import waitNodeDataEquality, waitNodeDataUnequality | ||
|
||
# Do not remove the next import | ||
from plenum.test.node_catchup.conftest import whitelist | ||
|
||
logger = getlogger() | ||
txnCount = 5 | ||
|
||
|
||
# TODO: Refactor tests to minimize module-scoped fixtures.They make tests depend on each other | ||
def testNodeCatchupAfterLostConnection(newNodeCaughtUp, txnPoolNodeSet, | ||
nodeSetWithNodeAddedAfterSomeTxns): | ||
""" | ||
A node that has poor internet connection and got unsynced after some transactions should eventually get the | ||
transactions which happened while it was not accessible | ||
:return: | ||
""" | ||
looper, newNode, client, wallet, _, _ = nodeSetWithNodeAddedAfterSomeTxns | ||
logger.debug("Stopping node {} with pool ledger size {}". | ||
format(newNode, newNode.poolManager.txnSeqNo)) | ||
looper.removeProdable(newNode) | ||
# TODO: Check if the node has really stopped processing requests? | ||
logger.debug("Sending requests") | ||
sendReqsToNodesAndVerifySuffReplies(looper, wallet, client, 5) | ||
# Make sure new node got out of sync | ||
waitNodeDataUnequality(looper, newNode, *txnPoolNodeSet[:-1]) | ||
logger.debug("Ensure node {} gets disconnected".format(newNode)) | ||
ensure_node_disconnected(looper, newNode, txnPoolNodeSet[:-1]) | ||
logger.debug("Starting the stopped node, {}".format(newNode)) | ||
looper.add(newNode) | ||
logger.debug("Waiting for the node to catch up, {}".format(newNode)) | ||
waitNodeDataEquality(looper, newNode, *txnPoolNodeSet[:-1]) |
mode
is set toparticipating
inallLedgersCaughtUp
since a node should not participate till all ledgers have caught up.