[New SDK] try to fix testPropagateRecvdAfterRequest
+import types
import pytest
from plenum.common.constants import PROPAGATE
-from plenum.test.helper import sdk_json_to_request_object
+from plenum.test.helper import sdk_json_to_request_object, sdk_send_random_requests
from stp_core.loop.eventually import eventually
from plenum.common.messages.node_messages import Propagate
from plenum.test.delayers import delay, msg_rep_delay
@@ -14,17 +15,26 @@ howlong = 5
@pytest.fixture()
-def setup(txnPoolNodeSet):
+def setup(txnPoolNodeSet, looper, sdk_pool_handle, sdk_wallet_client,):
+ def _clean():
+ pass
+
A, B, C, D = txnPoolNodeSet # type: TestNode
delay(Propagate, frm=[B, C, D], to=A, howlong=howlong)
# Delay MessageRep by long simulating loss as if Propagate is missing, it
# is requested
A.nodeIbStasher.delay(msg_rep_delay(10 * howlong, [PROPAGATE, ]))
+ # disable _clean method which remove req.key from requests map
+ A.requests._clean = types.MethodType(
+ _clean, A.requests)
+ request_couple_json = sdk_send_random_requests(
+ looper, sdk_pool_handle, sdk_wallet_client, 1)
+ return request_couple_json
-def testPropagateRecvdAfterRequest(setup, looper, txnPoolNodeSet, sent1):
+def testPropagateRecvdAfterRequest(setup, looper, txnPoolNodeSet):
A, B, C, D = txnPoolNodeSet # type: TestNode
- sent1 = sdk_json_to_request_object(sent1[0][0])
+ sent1 = sdk_json_to_request_object(setup[0][0])
def x():
# A should have received a request from the client
@@ -36,6 +46,8 @@ def testPropagateRecvdAfterRequest(setup, looper, txnPoolNodeSet, sent1):
timeout = howlong - 2
looper.run(eventually(x, retryWait=.5, timeout=timeout))
+ for n in txnPoolNodeSet:
+ n.nodeIbStasher.resetDelays()
def y():
# A should have received 3 PROPAGATEs
