コード例 #1
0
def testReplyWhenRepliesFromExactlyFPlusOneNodesAreSame(looper, client1):
    """
    When only :math:`2f+1` replies from the nodes are matching, the client
    would accept the reply
    """
    request = sendRandomRequest(client1)
    # exactly f + 1 => (3) nodes have correct responses
    # modify some (numOfResponses of type REPLY - (f + 1)) => 4 responses to
    # have a different operations
    looper.run(
        eventually(assertLength,
                   client1.inBox,
                   2 * nodeCount * request.reqId,
                   retryWait=.25,
                   timeout=15))

    replies = (msg for msg, frm in client1.inBox if msg[OP_FIELD_NAME] == REPLY
               and msg[f.RESULT.nm][f.REQ_ID.nm] == request.reqId)

    # change two responses to something different
    for i in range(2):
        msg = next(replies)
        msg[f.RESULT.nm][TXN_ID] = str(i) + "Some random id"

    checkResponseCorrectnessFromNodes(client1.inBox, request.reqId, F)
コード例 #2
0
ファイル: test_client.py プロジェクト: yarasan/indy-plenum
def testReplyWhenRepliesFromExactlyFPlusOneNodesAreSame(
        looper, client1, wallet1):
    """
    When only :math:`f+1` replies from the nodes are matching, the client
    would accept the reply
    """
    request = sendRandomRequest(wallet1, client1)
    # exactly f + 1 => (3) nodes have correct responses
    # modify some (numOfResponses of type REPLY - (f + 1)) => 4 responses to
    # have a different operations
    responseTimeout = waits.expectedTransactionExecutionTime(nodeCount)
    looper.run(
        eventually(checkResponseRecvdFromNodes,
                   client1,
                   nodeCount,
                   request.reqId,
                   retryWait=1,
                   timeout=responseTimeout))

    replies = (msg for msg, frm in client1.inBox if msg[OP_FIELD_NAME] == REPLY
               and msg[f.RESULT.nm][f.REQ_ID.nm] == request.reqId)

    # change two responses to something different
    for i in range(2):
        msg = next(replies)
        msg[f.RESULT.nm][f.SIG.nm] = str(i) + "Some random id"

    checkResponseCorrectnessFromNodes(client1.inBox, request.reqId, F)
コード例 #3
0
ファイル: test_client.py プロジェクト: evernym/plenum
def testReplyWhenRepliesFromExactlyFPlusOneNodesAreSame(looper,
                                                        client1,
                                                        wallet1):
    """
    When only :math:`2f+1` replies from the nodes are matching, the client
    would accept the reply
    """
    request = sendRandomRequest(wallet1, client1)
    # exactly f + 1 => (3) nodes have correct responses
    # modify some (numOfResponses of type REPLY - (f + 1)) => 4 responses to
    # have a different operations
    looper.run(
            eventually(checkResponseRecvdFromNodes, client1,
                       2 * nodeCount, request.reqId,
                       retryWait=1, timeout=20))

    replies = (msg for msg, frm in client1.inBox
               if msg[OP_FIELD_NAME] == REPLY and
               msg[f.RESULT.nm][f.REQ_ID.nm] == request.reqId)

    # change two responses to something different
    for i in range(2):
        msg = next(replies)
        msg[f.RESULT.nm][TXN_ID] = str(i) + "Some random id"

    checkResponseCorrectnessFromNodes(client1.inBox, request.reqId, F)
コード例 #4
0
ファイル: test_client.py プロジェクト: peacekeeper/plenum
def testReplyWhenRepliesFromAllNodesAreSame(looper, client1):
    """
    When there are not faulty nodes, the client must get a reply from all the
    nodes.
    """
    request = sendRandomRequest(client1)
    looper.run(
            eventually(assertLength, client1.inBox,
                       2 * nodeCount * request.reqId,
                       retryWait=.25, timeout=15))
    checkResponseCorrectnessFromNodes(client1.inBox, request.reqId, F)
コード例 #5
0
ファイル: test_client.py プロジェクト: loxadim/plenum
def testReplyWhenRepliesFromAllNodesAreSame(looper, client1, wallet1):
    """
    When there are not faulty nodes, the client must get a reply from all the
    nodes.
    """
    request = sendRandomRequest(wallet1, client1)
    looper.run(
            eventually(checkResponseRecvdFromNodes, client1,
                       2 * nodeCount, request.reqId,
                       retryWait=1, timeout=20))
    checkResponseCorrectnessFromNodes(client1.inBox, request.reqId, F)
コード例 #6
0
ファイル: test_client.py プロジェクト: evernym/plenum
def testReplyWhenRepliesFromAllNodesAreSame(looper, client1, wallet1):
    """
    When there are not faulty nodes, the client must get a reply from all the
    nodes.
    """
    request = sendRandomRequest(wallet1, client1)
    looper.run(
            eventually(checkResponseRecvdFromNodes, client1,
                       2 * nodeCount, request.reqId,
                       retryWait=1, timeout=20))
    checkResponseCorrectnessFromNodes(client1.inBox, request.reqId, F)
コード例 #7
0
def testReplyWhenRepliesFromAllNodesAreSame(looper, client1):
    """
    When there are not faulty nodes, the client must get a reply from all the
    nodes.
    """
    request = sendRandomRequest(client1)
    looper.run(
        eventually(assertLength,
                   client1.inBox,
                   2 * nodeCount * request.reqId,
                   retryWait=.25,
                   timeout=15))
    checkResponseCorrectnessFromNodes(client1.inBox, request.reqId, F)
コード例 #8
0
def test_state_proof_checked_in_client_request(looper, txnPoolNodeSet,
                                               client1,  wallet1):
    """
    Checks that client cat use state proofs instead of quorum for replies.

    To implement this test state proof is added to replies for
    'greeting' requests in TestNode. Parsing added to TestClient.
    """
    request = sendRandomRequest(wallet1, client1)
    responseTimeout = waits.expectedTransactionExecutionTime(nodeCount)
    looper.run(
        eventually(check_proved_reply_received,
                   client1, request.identifier, request.reqId,
                   retryWait=1, timeout=responseTimeout))
    checkResponseCorrectnessFromNodes(client1.inBox, request.reqId, F)
コード例 #9
0
ファイル: test_client.py プロジェクト: jbest2015/plenum
def testReplyWhenRepliesFromExactlyFPlusOneNodesAreSame(looper, client1):
    """
    When only :math:`2f+1` replies from the nodes are matching, the client
    would accept the reply
    """
    request = sendRandomRequest(client1)
    # exactly f + 1 => (3) nodes have correct responses
    # modify some (numOfResponses of type REPLY - (f + 1)) => 4 responses to
    # have a different operations
    looper.run(
            eventually(assertLength, client1.inBox,
                       2 * nodeCount * request.reqId,
                       retryWait=.25, timeout=15))

    replies = (msg for msg, frm in client1.inBox
               if msg['op'] == REPLY and
               msg['reqId'] == request.reqId)

    # change two responses to something different
    for i in range(2):
        msg = next(replies)
        msg['result']['txnId'] = str(i) + "Some random id"

    checkResponseCorrectnessFromNodes(client1.inBox, request.reqId, F)