Revision 7227da6531c2e32c033e5687acefd8825f623c7c authored by Sylvain Ribstein on 20 April 2022, 13:20:30 UTC, committed by Thomas Letan on 21 April 2022, 12:42:28 UTC
1 parent 1ba0fc6
test_many_nodes.py
import random
import time
import pytest
from tools import utils, constants
from launchers.sandbox import Sandbox
from . import protocol
NUM_NODES = 2
NEW_NODES = 2
REPLACE = False
ERROR_PATTERN = r"Uncaught|registered"
@pytest.mark.baker
@pytest.mark.multinode
@pytest.mark.slow
@pytest.mark.incremental
class TestManyNodesBootstrap:
"""Run many nodes, wait a while, run more nodes, check logs"""
def test_init(self, sandbox: Sandbox):
sandbox.add_node(0, params=constants.NODE_PARAMS)
parameters = dict(protocol.PARAMETERS)
parameters["time_between_blocks"] = ["1", "0"]
protocol.activate(sandbox.client(0), parameters)
sandbox.add_baker(0, ['bootstrap1'], proto=protocol.DAEMON)
sandbox.add_node(1, params=constants.NODE_PARAMS)
sandbox.add_baker(1, ['bootstrap2'], proto=protocol.DAEMON)
def test_add_nodes(self, sandbox: Sandbox):
for i in range(2, NUM_NODES):
sandbox.add_node(i, params=constants.NODE_PARAMS)
def test_sleep_10s(self):
time.sleep(10)
def test_add_more_nodes(self, sandbox: Sandbox):
new_node = NUM_NODES
for i in range(NEW_NODES):
if REPLACE:
running_nodes = list(sandbox.nodes.keys())
running_nodes.remove(0)
running_nodes.remove(1)
sandbox.rm_node(random.choice(running_nodes))
sandbox.add_node(new_node + i, params=constants.NODE_PARAMS)
def test_kill_baker(self, sandbox: Sandbox):
assert utils.check_logs(sandbox.logs, ERROR_PATTERN)
sandbox.rm_baker(0, proto=protocol.DAEMON)
sandbox.rm_baker(1, proto=protocol.DAEMON)
def test_synchronize(self, sandbox: Sandbox):
utils.synchronize(sandbox.all_clients())
def test_progress(self, sandbox: Sandbox):
level = sandbox.client(0).get_level()
assert level >= 5
def test_check_logs(self, sandbox: Sandbox):
if not sandbox.log_dir:
pytest.skip()
assert sandbox.logs
assert utils.check_logs(sandbox.logs, ERROR_PATTERN)
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...