<commit_before>import pytest
from plenum.test.delayers import ppgDelay, req_delay
from plenum.test.spy_helpers import get_count, getAllReturnVals
from plenum.test.test_node import getNonPrimaryReplicas
from plenum.test.helper import sdk_send_random_and_check
from plenum.test.node_request.helper import sdk_ensure_pool_functional


@pytest.fixture(scope='function', params=['client_requests',
                                          'no_client_requests'])
def setup(request, txnPoolNodeSet):
    # Test once when client request is received and once when not received

    # Choosing a faulty node which is primary in neither instance, this helps
    # in the that same PROPAGATEs are not requested again by the node
    faulty_node = getNonPrimaryReplicas(txnPoolNodeSet, 0)[1].node
    if request.param == 'client_requests':
        # Long delay in PROPAGATEs
        faulty_node.nodeIbStasher.delay(ppgDelay(90))
        return faulty_node, True
    if request.param == 'no_client_requests':
        # Long delay in PROPAGATEs
        faulty_node.nodeIbStasher.delay(ppgDelay(90))
        # Long delay in Client Requests
        faulty_node.clientIbStasher.delay(req_delay(90))
        return faulty_node, False


@pytest.fixture(scope="module")
def tconf(tconf):
    old_max3PC = tconf.Max3PCBatchSize
    old_wait = tconf.Max3PCBatchWait
    yield tconf
    tconf.Max3PCBatchSize = 1
    tconf.Max3PCBatchWait = 100



def test_node_request_propagates(looper, setup, txnPoolNodeSet,
                                 sdk_wallet_client, sdk_pool_handle):<commit_msg>[INDY-1387] MaxBatch parameters<commit_after>import pytest
from plenum.test.delayers import ppgDelay, req_delay
from plenum.test.spy_helpers import get_count, getAllReturnVals
from plenum.test.test_node import getNonPrimaryReplicas
from plenum.test.helper import sdk_send_random_and_check
from plenum.test.node_request.helper import sdk_ensure_pool_functional


@pytest.fixture(scope='function', params=['client_requests',
                                          'no_client_requests'])
def setup(request, txnPoolNodeSet):
    # Test once when client request is received and once when not received

    # Choosing a faulty node which is primary in neither instance, this helps
    # in the that same PROPAGATEs are not requested again by the node
    faulty_node = getNonPrimaryReplicas(txnPoolNodeSet, 0)[1].node
    if request.param == 'client_requests':
        # Long delay in PROPAGATEs
        faulty_node.nodeIbStasher.delay(ppgDelay(90))
        return faulty_node, True
    if request.param == 'no_client_requests':
        # Long delay in PROPAGATEs
        faulty_node.nodeIbStasher.delay(ppgDelay(90))
        # Long delay in Client Requests
        faulty_node.clientIbStasher.delay(req_delay(90))
        return faulty_node, False


@pytest.fixture(scope="module")
def tconf(tconf):
    old_max3PC = tconf.Max3PCBatchSize
    old_wait = tconf.Max3PCBatchWait
    tconf.Max3PCBatchSize = 1
    tconf.Max3PCBatchWait = 100
    yield tconf
    tconf.Max3PCBatchSize = old_max3PC
    tconf.Max3PCBatchWait = old_wait



def test_node_request_propagates(looper, setup, txnPoolNodeSet,
                                 sdk_wallet_client, sdk_pool_handle):
{'fraction_non_alphanumeric': 0.06833642547928262, 'fraction_numerical': 0.012677798392084107, 'mean_word_length': 3.556338028169014, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4335696', 'n_tokens_mistral': 1040, 'n_tokens_neox': 1002, 'n_words': 237}