update test_view_change_with_lost_new_view
import pytest
+from plenum.test.test_node import ensureElectionsDone
+
from plenum.common.messages.node_messages import NewView
from plenum.test.helper import sdk_send_random_and_check, waitForViewChange
from plenum.test.node_catchup.helper import ensure_all_nodes_have_same_data
@@ -7,7 +9,16 @@ from plenum.test.node_request.helper import sdk_ensure_pool_functional
call_count = 0
-@pytest.fixture(scope='function', params=range(1, 3))
+@pytest.fixture(scope="module")
+def tconf(tconf):
+ old_timeout = tconf.NEW_VIEW_TIMEOUT
+ tconf.NEW_VIEW_TIMEOUT = 7
+ yield tconf
+
+ tconf.NEW_VIEW_TIMEOUT = old_timeout
+
+
+@pytest.fixture(scope='function', params=range(1, 5))
def lost_count(request):
return request.param
@@ -18,8 +29,6 @@ def test_view_change_with_lost_new_view(txnPoolNodeSet,
sdk_wallet_steward,
tconf,
tdir,
- allPluginsPath,
- monkeypatch,
lost_count):
'''
Skip processing of lost_count Message Responses with NewView
@@ -48,6 +57,8 @@ def test_view_change_with_lost_new_view(txnPoolNodeSet,
for n in txnPoolNodeSet:
n.view_changer.on_master_degradation()
waitForViewChange(looper, txnPoolNodeSet, expectedViewNo=initial_view_no + 1)
+ ensureElectionsDone(looper=looper, nodes=txnPoolNodeSet,
+ customTimeout=tconf.NEW_VIEW_TIMEOUT * (call_count + 1))
ensure_all_nodes_have_same_data(looper, nodes=txnPoolNodeSet)
# make sure that the pool is functional
