@@ -0,0 +1,1989 @@
+import pytest%0A%0Afrom plenum.test.helper import max_3pc_batch_limits, sdk_send_random_requests, sdk_get_and_check_replies%0Afrom plenum.test.node_catchup.helper import ensure_all_nodes_have_same_data%0Afrom stp_core.common.log import getlogger%0A%0ABATCHES_TO_ORDER = 20%0AMAX_BATCHES_IN_FLIGHT = 4%0A%0Alogger = getlogger()%0A%0A%0A@pytest.fixture(scope=%22module%22)%0Adef tconf(tconf):%0A    with max_3pc_batch_limits(tconf, size=1) as tconf:%0A        old = tconf.Max3PCBatchesInFlight%0A        tconf.Max3PCBatchesInFlight = MAX_BATCHES_IN_FLIGHT%0A        yield tconf%0A        tconf.Max3PCBatchesInFlight = old%0A%0A%0Adef test_max_3pc_batches_in_flight(tdir, tconf,%0A                                   looper,%0A                                   txnPoolNodeSet,%0A                                   sdk_pool_handle,%0A                                   sdk_wallet_client):%0A    # Check pool initial state%0A    initial_3pc = txnPoolNodeSet%5B0%5D.master_replica.last_ordered_3pc%0A    for node in txnPoolNodeSet%5B1:%5D:%0A        assert node.master_replica.last_ordered_3pc == initial_3pc%0A%0A    # Utility%0A    def has_requests_to_order():%0A        for node in txnPoolNodeSet:%0A            if node.master_replica.last_ordered_3pc%5B1%5D %3C initial_3pc%5B1%5D + BATCHES_TO_ORDER:%0A                return True%0A        return False%0A%0A    # Send a number of requests%0A    reqs = sdk_send_random_requests(looper, sdk_pool_handle, sdk_wallet_client, BATCHES_TO_ORDER)%0A%0A    # Continuously check number of batches in flight%0A    while has_requests_to_order():%0A        logger.info(%22Next cycle%22)%0A        for node in txnPoolNodeSet:%0A            for replica in node.replicas.values():%0A                batches_in_flight = replica.lastPrePrepareSeqNo - replica.last_ordered_3pc%5B1%5D%0A                assert batches_in_flight %3C= MAX_BATCHES_IN_FLIGHT%0A        looper.runFor(0.01)%0A%0A    # Check all requests are ordered%0A    sdk_get_and_check_replies(looper, reqs)%0A%0A    # Ensure that all nodes will eventually have same data%0A    ensure_all_nodes_have_same_data(looper, txnPoolNodeSet)%0A

Add test_max_3pc_batches_in_flight