From f4c720a4d62d7c94d8e4231f2760d483d53f7dce Mon Sep 17 00:00:00 2001 From: ArtObr Date: Mon, 5 Mar 2018 19:41:42 +0300 Subject: [PATCH 1/2] tests done Signed-off-by: ArtObr --- .../test/batching_3pc/test_batch_rejection.py | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/plenum/test/batching_3pc/test_batch_rejection.py b/plenum/test/batching_3pc/test_batch_rejection.py index 0bb01c9c4c..503f325a25 100644 --- a/plenum/test/batching_3pc/test_batch_rejection.py +++ b/plenum/test/batching_3pc/test_batch_rejection.py @@ -6,22 +6,18 @@ from plenum.common.constants import DOMAIN_LEDGER_ID from plenum.common.util import updateNamedTuple from plenum.test.helper import sendRandomRequests, \ - waitForSufficientRepliesForRequests + waitForSufficientRepliesForRequests, sdk_send_random_requests, sdk_send_random_and_check from plenum.test.test_node import getNonPrimaryReplicas, getPrimaryReplica @pytest.fixture(scope="module") -def setup(tconf, looper, txnPoolNodeSet, client, wallet1): +def setup(tconf, looper, txnPoolNodeSet, sdk_pool_handle, sdk_wallet_client): # Patch the 3phase request sending method to send incorrect digest and pr, otherR = getPrimaryReplica(txnPoolNodeSet, instId=0), \ - getNonPrimaryReplicas(txnPoolNodeSet, instId=0) - - reqs = sendRandomRequests(wallet1, client, tconf.Max3PCBatchSize) - waitForSufficientRepliesForRequests( - looper, - client, - requests=reqs, - customTimeoutPerReq=tconf.Max3PCBatchWait) + getNonPrimaryReplicas(txnPoolNodeSet, instId=0) + + sdk_send_random_and_check(looper, txnPoolNodeSet, sdk_pool_handle, + sdk_wallet_client, tconf.Max3PCBatchSize) stateRoot = pr.stateRootHash(DOMAIN_LEDGER_ID, to_str=False) origMethod = pr.create3PCBatch @@ -36,7 +32,8 @@ def badMethod(self, ledgerId): return pp pr.create3PCBatch = types.MethodType(badMethod, pr) - sendRandomRequests(wallet1, client, tconf.Max3PCBatchSize) + sdk_send_random_requests(looper, sdk_pool_handle, sdk_wallet_client, + tconf.Max3PCBatchSize) return pr, otherR, stateRoot @@ -75,15 +72,13 @@ def testViewChangeAfterBatchRejected(viewChanged): """ -def testMoreBatchesWillBeSentAfterViewChange(reverted, viewChanged, wallet1, - client, tconf, looper): +def testMoreBatchesWillBeSentAfterViewChange(reverted, viewChanged, + txnPoolNodeSet, + sdk_pool_handle, sdk_wallet_client, + tconf, looper): """ After retrying discarded batches, new batches are sent :return: """ - reqs = sendRandomRequests(wallet1, client, tconf.Max3PCBatchSize) - waitForSufficientRepliesForRequests( - looper, - client, - requests=reqs, - customTimeoutPerReq=tconf.Max3PCBatchWait) + sdk_send_random_and_check(looper, txnPoolNodeSet, sdk_pool_handle, + sdk_wallet_client, tconf.Max3PCBatchSize) From 9a8f333f9ed4b208718b2daea3f14981c44208f9 Mon Sep 17 00:00:00 2001 From: ArtObr Date: Mon, 5 Mar 2018 19:45:01 +0300 Subject: [PATCH 2/2] import fixes Signed-off-by: ArtObr --- plenum/test/batching_3pc/test_batch_rejection.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plenum/test/batching_3pc/test_batch_rejection.py b/plenum/test/batching_3pc/test_batch_rejection.py index 503f325a25..e0e671dd04 100644 --- a/plenum/test/batching_3pc/test_batch_rejection.py +++ b/plenum/test/batching_3pc/test_batch_rejection.py @@ -5,9 +5,10 @@ from stp_core.loop.eventually import eventually from plenum.common.constants import DOMAIN_LEDGER_ID from plenum.common.util import updateNamedTuple -from plenum.test.helper import sendRandomRequests, \ - waitForSufficientRepliesForRequests, sdk_send_random_requests, sdk_send_random_and_check -from plenum.test.test_node import getNonPrimaryReplicas, getPrimaryReplica +from plenum.test.helper import sdk_send_random_requests, \ + sdk_send_random_and_check +from plenum.test.test_node import getNonPrimaryReplicas, \ + getPrimaryReplica @pytest.fixture(scope="module")