Only set low timeouts when we expect `wait_for_new_primary` to fail (#4798)

This commit is contained in:
Eddy Ashton 2023-01-05 09:31:56 +00:00 коммит произвёл GitHub
Родитель 501ce57966
Коммит ea53c63af8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 16 добавлений и 7 удалений

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

@ -37,7 +37,7 @@ def test_kill_primary_no_reqs(network, args):
old_primary.stop()
new_primary, _ = network.wait_for_new_primary(old_primary, timeout_multiplier=5)
new_primary, _ = network.wait_for_new_primary(old_primary)
with new_primary.client() as c:
# Get the current view history
@ -220,14 +220,23 @@ def run(args):
network.wait_for_all_nodes_to_commit(tx_id=TxID(res.view, res.seqno))
try:
if node_to_stop == nodes_to_stop - 1:
# Killing this node goes past the service's fault tolerance threshold, so no primary can now be elected
primary.stop()
try:
# Use smaller timeout multiplier since we expect the service to be stuck, so must wait this long
network.wait_for_new_primary(
primary,
timeout_multiplier=5,
)
except PrimaryNotFound:
primary_is_known = False
else:
assert False, "Expected no primary to be found!"
else:
test_kill_primary_no_reqs(network, args)
test_commit_view_history(network, args)
except PrimaryNotFound:
if node_to_stop < nodes_to_stop - 1:
raise
else:
primary_is_known = False
assert not primary_is_known, "Primary is still known"
LOG.success("Test ended successfully.")