This commit is contained in:
Amaury Chamayou 2021-06-22 16:59:20 +01:00 коммит произвёл GitHub
Родитель 49419767af
Коммит ec1acf25bf
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 17 добавлений и 65 удалений

Просмотреть файл

@ -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(

Просмотреть файл

@ -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,
)