From ec1acf25bf72d719733e1c826c7ac862cfced917 Mon Sep 17 00:00:00 2001 From: Amaury Chamayou Date: Tue, 22 Jun 2021 16:59:20 +0100 Subject: [PATCH] Disable rotation test for BFT (#2708) --- CMakeLists.txt | 26 ++++++++++------------ tests/rotation.py | 56 +++++------------------------------------------ 2 files changed, 17 insertions(+), 65 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 40a6e65612..1941854fa4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -811,6 +811,18 @@ if(BUILD_TESTS) ADDITIONAL_ARGS ${LTS_TEST_ARGS} ) + if(LONG_TESTS) + set(ROTATION_TEST_ARGS --rotation-retirements 10 --rotation-suspensions 10) + endif() + + add_e2e_test( + NAME rotation_test_cft + PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/rotation.py + CONSENSUS cft + LABEL rotation + ADDITIONAL_ARGS ${ROTATION_TEST_ARGS} + ) + foreach(CONSENSUS ${CONSENSUSES}) add_e2e_test( NAME cpp_e2e_logging_${CONSENSUS} @@ -847,20 +859,6 @@ if(BUILD_TESTS) ADDITIONAL_ARGS -p liblogging --duration 45m ) - if(LONG_TESTS) - set(ROTATION_TEST_ARGS --rotation-retirements 10 --rotation-suspensions - 10 - ) - endif() - - add_e2e_test( - NAME rotation_test_${CONSENSUS} - PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/rotation.py - CONSENSUS ${CONSENSUS} - LABEL rotation - ADDITIONAL_ARGS ${ROTATION_TEST_ARGS} - ) - endforeach() add_perf_test( diff --git a/tests/rotation.py b/tests/rotation.py index 0533f6ad78..da24379941 100644 --- a/tests/rotation.py +++ b/tests/rotation.py @@ -3,42 +3,11 @@ import infra.e2e_args import infra.network import infra.proc -import suite.test_requirements as reqs import reconfiguration -import time -from infra.checker import check_can_progress -from ccf.clients import CCFConnectionException from loguru import logger as LOG -@reqs.description("Suspend and resume primary") -@reqs.can_kill_n_nodes(1) -def test_suspend_primary(network, args): - primary, backup = network.find_primary_and_any_backup() - primary.suspend() - if args.consensus == "bft": - try: - for _ in range(3): - with backup.client("user0") as c: - _ = c.post( - "/app/log/private", - { - "id": -1, - "msg": "This is submitted to force a view change", - }, - ) - time.sleep(5) - backup = network.find_any_backup() - except CCFConnectionException: - LOG.warning(f"Could not successfully connect to node {backup.node_id}.") - new_primary, _ = network.wait_for_new_primary(primary) - check_can_progress(new_primary) - primary.resume() - check_can_progress(new_primary) - return network - - def run(args): with infra.network.network( args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb @@ -46,20 +15,11 @@ def run(args): network.start_and_join(args) # Replace primary repeatedly and check the network still operates - if args.consensus != "bft": - LOG.info(f"Retiring primary {args.rotation_retirements} times") - for i in range(args.rotation_retirements): - LOG.warning(f"Retirement {i}") - reconfiguration.test_add_node(network, args) - reconfiguration.test_retire_primary(network, args) - - if args.consensus == "bft": + LOG.info(f"Retiring primary {args.rotation_retirements} times") + for i in range(args.rotation_retirements): + LOG.warning(f"Retirement {i}") reconfiguration.test_add_node(network, args) - # Suspend primary repeatedly and check the network still operates - LOG.info(f"Suspending primary {args.rotation_suspensions} times") - for i in range(args.rotation_suspensions): - LOG.warning(f"Suspension {i}") - test_suspend_primary(network, args) + reconfiguration.test_retire_primary(network, args) if __name__ == "__main__": @@ -67,13 +27,7 @@ if __name__ == "__main__": def add(parser): parser.add_argument( "--rotation-retirements", - help="Number of times to retired the primary", - type=int, - default=3, - ) - parser.add_argument( - "--rotation-suspensions", - help="Number of times to suspend the primary", + help="Number of times to retire the primary", type=int, default=3, )