зеркало из https://github.com/microsoft/CCF.git
Explicit node flags (#1803)
This commit is contained in:
Родитель
60c8e0883c
Коммит
891f8335ed
|
@ -3,5 +3,5 @@
|
|||
HN=$(hostname)
|
||||
|
||||
if [ "$HN" == "ccf-perf-uk-0" ]; then
|
||||
echo "-n 10.1.0.7 -n 10.1.0.4 -n 10.1.0.5"
|
||||
echo "-n ssh://10.1.0.7 -n ssh://10.1.0.4 -n ssh://10.1.0.5"
|
||||
fi
|
|
@ -13,7 +13,7 @@ set(DISTRIBUTE_PERF_TESTS
|
|||
""
|
||||
CACHE
|
||||
STRING
|
||||
"Hosts to which performance tests should be distributed, for example -n x.x.x.x -n x.x.x.x -n x.x.x.x"
|
||||
"Hosts to which performance tests should be distributed, for example -n ssh://x.x.x.x -n ssh://x.x.x.x -n ssh://x.x.x.x"
|
||||
)
|
||||
|
||||
if(DISTRIBUTE_PERF_TESTS)
|
||||
|
|
|
@ -12,7 +12,7 @@ export const NODE_ADDR = 'https://' + NODE_HOST
|
|||
|
||||
export function getCCFSandboxCmdAndArgs(app_bundle_dir: string) {
|
||||
const CCF_SANDBOX_ARGS = [
|
||||
'--node', NODE_HOST,
|
||||
'--node', 'local://' + NODE_HOST,
|
||||
'--js-app-bundle', app_bundle_dir,
|
||||
'--workspace', '.workspace_ccf'
|
||||
]
|
||||
|
|
|
@ -89,7 +89,7 @@ def test_update_all_nodes(network, args):
|
|||
}, r.body
|
||||
|
||||
LOG.info("Adding a new node")
|
||||
new_node = network.create_and_trust_node(args.package, "localhost", args)
|
||||
new_node = network.create_and_trust_node(args.package, "local://localhost", args)
|
||||
assert new_node
|
||||
|
||||
new_code_id = get_code_id(
|
||||
|
@ -101,7 +101,7 @@ def test_update_all_nodes(network, args):
|
|||
code_not_found_exception = None
|
||||
try:
|
||||
network.create_and_add_pending_node(
|
||||
args.patched_file_name, "localhost", args, timeout=3
|
||||
args.patched_file_name, "local://localhost", args, timeout=3
|
||||
)
|
||||
except infra.network.CodeIdNotFound as err:
|
||||
code_not_found_exception = err
|
||||
|
@ -136,7 +136,7 @@ def test_update_all_nodes(network, args):
|
|||
)
|
||||
for _ in range(0, new_nodes_count):
|
||||
new_node = network.create_and_trust_node(
|
||||
args.patched_file_name, "localhost", args
|
||||
args.patched_file_name, "local://localhost", args
|
||||
)
|
||||
assert new_node
|
||||
new_nodes.add(new_node)
|
||||
|
@ -151,7 +151,9 @@ def test_update_all_nodes(network, args):
|
|||
LOG.info(f"New_primary is {new_primary.node_id}")
|
||||
|
||||
LOG.info("Adding another node to the network")
|
||||
new_node = network.create_and_trust_node(args.patched_file_name, "localhost", args)
|
||||
new_node = network.create_and_trust_node(
|
||||
args.patched_file_name, "local://localhost", args
|
||||
)
|
||||
assert new_node
|
||||
network.wait_for_node_commit_sync()
|
||||
|
||||
|
@ -173,7 +175,9 @@ def test_update_all_nodes(network, args):
|
|||
LOG.info(f"Adding a node with retired code id {first_code_id}")
|
||||
code_not_found_exception = None
|
||||
try:
|
||||
network.create_and_add_pending_node(args.package, "localhost", args, timeout=3)
|
||||
network.create_and_add_pending_node(
|
||||
args.package, "local://localhost", args, timeout=3
|
||||
)
|
||||
except infra.network.CodeIdRetired as err:
|
||||
code_not_found_exception = err
|
||||
|
||||
|
@ -182,16 +186,16 @@ def test_update_all_nodes(network, args):
|
|||
), f"Adding a node with unsupported code id {new_code_id} should fail"
|
||||
|
||||
LOG.info("Adding another node with the new code to the network")
|
||||
new_node = network.create_and_trust_node(args.patched_file_name, "localhost", args)
|
||||
new_node = network.create_and_trust_node(
|
||||
args.patched_file_name, "local://localhost", args
|
||||
)
|
||||
assert new_node
|
||||
network.wait_for_node_commit_sync()
|
||||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost", "localhost"]
|
||||
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
) as network:
|
||||
network.start_and_join(args)
|
||||
|
||||
|
@ -208,4 +212,5 @@ if __name__ == "__main__":
|
|||
|
||||
args.package = args.app_script and "liblua_generic" or "liblogging"
|
||||
args.patched_file_name = "{}.patched".format(args.package)
|
||||
args.nodes = infra.e2e_args.max_nodes(args, f=0)
|
||||
run(args)
|
||||
|
|
|
@ -34,7 +34,10 @@ def wait_for_pending(client, view, seqno, timeout=3):
|
|||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost"] * 5
|
||||
# This is deliberately 5, because the rest of the test depends on this
|
||||
# to grow a prefix and allow just enough nodes to resume to reach the
|
||||
# desired election result. Conversion to a general f isn't trivial.
|
||||
hosts = ["local://localhost"] * 5
|
||||
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
|
|
|
@ -13,10 +13,8 @@ from loguru import logger as LOG
|
|||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost"] * (4 if args.consensus == "bft" else 1)
|
||||
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
) as network:
|
||||
check = infra.checker.Checker()
|
||||
network.start_and_join(args)
|
||||
|
@ -101,4 +99,5 @@ if __name__ == "__main__":
|
|||
|
||||
args = infra.e2e_args.cli_args()
|
||||
args.package = args.app_script and "liblua_generic" or "liblogging"
|
||||
args.nodes = ["local://localhost"]
|
||||
run(args)
|
||||
|
|
|
@ -127,10 +127,8 @@ def test_unknown_path(network, args):
|
|||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost"] * (3 if args.consensus == "pbft" else 2)
|
||||
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
) as network:
|
||||
network.start_and_join(args)
|
||||
network = test_content_types(network, args)
|
||||
|
@ -141,4 +139,5 @@ if __name__ == "__main__":
|
|||
|
||||
args = infra.e2e_args.cli_args()
|
||||
args.package = "libjs_generic"
|
||||
args.nodes = infra.e2e_args.max_nodes(args, f=0)
|
||||
run(args)
|
||||
|
|
|
@ -44,10 +44,8 @@ def test_custom_auth(network, args):
|
|||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost"] * (3 if args.consensus == "bft" else 2)
|
||||
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
) as network:
|
||||
network.start_and_join(args)
|
||||
network = test_custom_auth(network, args)
|
||||
|
@ -57,4 +55,5 @@ if __name__ == "__main__":
|
|||
|
||||
args = infra.e2e_args.cli_args()
|
||||
args.package = "libjs_generic"
|
||||
args.nodes = infra.e2e_args.max_nodes(args, f=0)
|
||||
run(args)
|
||||
|
|
|
@ -59,10 +59,8 @@ def test(network, args, batch_size=100, write_key_divisor=1, write_size_multipli
|
|||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost", "localhost", "localhost"]
|
||||
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
) as network:
|
||||
network.start_and_join(args)
|
||||
|
||||
|
@ -93,10 +91,8 @@ def run(args):
|
|||
|
||||
|
||||
def run_to_destruction(args):
|
||||
hosts = ["localhost", "localhost", "localhost"]
|
||||
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
) as network:
|
||||
network.start_and_join(args)
|
||||
|
||||
|
@ -137,7 +133,7 @@ if __name__ == "__main__":
|
|||
args = infra.e2e_args.cli_args()
|
||||
args.package = "liblua_generic"
|
||||
args.enforce_reqs = True
|
||||
args.nodes = infra.e2e_args.min_nodes(args, f=1)
|
||||
|
||||
run(args)
|
||||
|
||||
run_to_destruction(args)
|
||||
|
|
|
@ -584,11 +584,14 @@ def test_memory(network, args):
|
|||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost"] * (3 if args.consensus == "bft" else 2)
|
||||
|
||||
txs = app.LoggingTxs()
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb, txs=txs
|
||||
args.nodes,
|
||||
args.binary_dir,
|
||||
args.debug_nodes,
|
||||
args.perf_nodes,
|
||||
pdb=args.pdb,
|
||||
txs=txs,
|
||||
) as network:
|
||||
network.start_and_join(args)
|
||||
|
||||
|
@ -622,5 +625,6 @@ if __name__ == "__main__":
|
|||
args.package = "liblua_generic"
|
||||
else:
|
||||
args.package = "liblogging"
|
||||
args.nodes = infra.e2e_args.max_nodes(args, f=0)
|
||||
|
||||
run(args)
|
||||
|
|
|
@ -17,9 +17,7 @@ def run(args):
|
|||
with open(args.scenario) as f:
|
||||
scenario = json.load(f)
|
||||
|
||||
hosts = scenario.get("hosts", ["localhost", "localhost"])
|
||||
if args.consensus == "bft":
|
||||
hosts = ["localhost"] * 3
|
||||
hosts = scenario.get("hosts", infra.e2e_args.max_nodes(args, f=0))
|
||||
args.package = scenario["package"]
|
||||
# SNIPPET_END: parsing
|
||||
|
||||
|
|
|
@ -49,10 +49,9 @@ def run(args):
|
|||
if args.enforce_reqs is False:
|
||||
LOG.warning("Test requirements will be ignored")
|
||||
|
||||
hosts = ["localhost", "localhost"]
|
||||
txs = app.LoggingTxs()
|
||||
network = infra.network.Network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, txs=txs
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, txs=txs
|
||||
)
|
||||
network.start_and_join(args)
|
||||
|
||||
|
@ -159,5 +158,6 @@ if __name__ == "__main__":
|
|||
|
||||
args = infra.e2e_args.cli_args(add)
|
||||
args.package = args.app_script and "liblua_generic" or "liblogging"
|
||||
args.nodes = infra.e2e_args.max_nodes(args, f=0)
|
||||
|
||||
run(args)
|
||||
|
|
|
@ -68,12 +68,8 @@ def wait_for_seqno_to_commit(seqno, view, nodes):
|
|||
|
||||
|
||||
def run(args):
|
||||
# Three nodes minimum to make sure that the raft network can still make progress
|
||||
# if one node stops
|
||||
hosts = ["localhost"] * (4 if args.consensus == "bft" else 3)
|
||||
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
) as network:
|
||||
check = infra.checker.Checker()
|
||||
|
||||
|
@ -81,9 +77,9 @@ def run(args):
|
|||
current_view = None
|
||||
|
||||
# Number of nodes F to stop until network cannot make progress
|
||||
nodes_to_stop = math.ceil(len(hosts) / 2)
|
||||
nodes_to_stop = math.ceil(len(args.nodes) / 2)
|
||||
if args.consensus == "bft":
|
||||
nodes_to_stop = math.ceil(len(hosts) / 3)
|
||||
nodes_to_stop = math.ceil(len(args.nodes) / 3)
|
||||
|
||||
primary_is_known = True
|
||||
for node_to_stop in range(nodes_to_stop):
|
||||
|
@ -129,4 +125,5 @@ if __name__ == "__main__":
|
|||
|
||||
args = infra.e2e_args.cli_args()
|
||||
args.package = "liblogging"
|
||||
args.nodes = infra.e2e_args.min_nodes(args, f=1)
|
||||
run(args)
|
||||
|
|
|
@ -83,7 +83,7 @@ def test_user(network, args, verify=True):
|
|||
@reqs.description("Add untrusted node, check no quote is returned")
|
||||
def test_no_quote(network, args):
|
||||
untrusted_node = network.create_and_add_pending_node(
|
||||
args.package, "localhost", args
|
||||
args.package, "local://localhost", args
|
||||
)
|
||||
with untrusted_node.client(
|
||||
ca=os.path.join(untrusted_node.common_dir, f"{untrusted_node.node_id}.pem")
|
||||
|
@ -119,10 +119,8 @@ def test_member_data(network, args):
|
|||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost"] * (3 if args.consensus == "bft" else 2)
|
||||
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
) as network:
|
||||
network.start_and_join(args)
|
||||
network = test_member_data(network, args)
|
||||
|
@ -138,4 +136,5 @@ if __name__ == "__main__":
|
|||
sys.exit(0)
|
||||
|
||||
args.package = "liblogging"
|
||||
args.nodes = infra.e2e_args.max_nodes(args, f=0)
|
||||
run(args)
|
||||
|
|
|
@ -31,10 +31,8 @@ def test_cert_signer_id_mismatch(network, args):
|
|||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost"] * (3 if args.consensus == "bft" else 2)
|
||||
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
) as network:
|
||||
network.start_and_join(args)
|
||||
network = test_cert_signer_id_mismatch(network, args)
|
||||
|
@ -44,4 +42,5 @@ if __name__ == "__main__":
|
|||
|
||||
args = infra.e2e_args.cli_args()
|
||||
args.package = "liblogging"
|
||||
args.nodes = infra.e2e_args.max_nodes(args, f=0)
|
||||
run(args)
|
||||
|
|
|
@ -83,10 +83,8 @@ def test_cert_store(network, args):
|
|||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost"] * (3 if args.consensus == "bft" else 2)
|
||||
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
) as network:
|
||||
network.start_and_join(args)
|
||||
network = test_cert_store(network, args)
|
||||
|
@ -96,4 +94,5 @@ if __name__ == "__main__":
|
|||
|
||||
args = infra.e2e_args.cli_args()
|
||||
args.package = "liblogging"
|
||||
args.nodes = infra.e2e_args.max_nodes(args, f=0)
|
||||
run(args)
|
||||
|
|
|
@ -52,15 +52,13 @@ def count_governance_operations(ledger):
|
|||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost", "localhost"]
|
||||
|
||||
# Keep track of how many propose, vote and withdraw are issued in this test
|
||||
proposals_issued = 0
|
||||
votes_issued = 0
|
||||
withdrawals_issued = 0
|
||||
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
) as network:
|
||||
network.start_and_join(args)
|
||||
primary, _ = network.find_primary()
|
||||
|
@ -121,7 +119,7 @@ def run(args):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
args = infra.e2e_args.cli_args()
|
||||
args.package = "liblogging"
|
||||
args.nodes = infra.e2e_args.max_nodes(args, f=0)
|
||||
run(args)
|
||||
|
|
|
@ -17,6 +17,25 @@ def absolute_path_to_existing_file(arg):
|
|||
return arg
|
||||
|
||||
|
||||
def min_nodes(args, f):
|
||||
"""
|
||||
Minimum number of nodes allowing 'f' faults for the
|
||||
consensus variant.
|
||||
"""
|
||||
if args.consensus == "bft":
|
||||
return ["local://localhost"] * (3 * f + 1)
|
||||
else:
|
||||
return ["local://localhost"] * (2 * f + 1)
|
||||
|
||||
|
||||
def max_nodes(args, f):
|
||||
"""
|
||||
Maximum number of nodes allowing no more than 'f'
|
||||
faults for the consensus variant.
|
||||
"""
|
||||
return min_nodes(args, f + 1)[:-1]
|
||||
|
||||
|
||||
def cli_args(add=lambda x: None, parser=None, accept_unknown=False):
|
||||
LOG.remove()
|
||||
LOG.add(
|
||||
|
|
|
@ -57,7 +57,14 @@ class Node:
|
|||
self.network_state = NodeNetworkState.stopped
|
||||
self.common_dir = None
|
||||
|
||||
hosts, *port = host.split(":")
|
||||
if host.startswith("local://"):
|
||||
self.remote_impl = infra.remote.LocalRemote
|
||||
elif host.startswith("ssh://"):
|
||||
self.remote_impl = infra.remote.SSHRemote
|
||||
else:
|
||||
assert False, f"{host} does not start with 'local://' or 'ssh://'"
|
||||
|
||||
hosts, *port = host[host.find("/") + 2 :].split(":")
|
||||
self.host, *self.pubhost = hosts.split(",")
|
||||
self.rpc_port = int(port[0]) if port else None
|
||||
self.node_port = None
|
||||
|
@ -65,11 +72,6 @@ class Node:
|
|||
if self.host == "localhost":
|
||||
self.host = infra.net.expand_localhost()
|
||||
|
||||
if is_addr_local(self.host, self.rpc_port):
|
||||
self.remote_impl = infra.remote.LocalRemote
|
||||
else:
|
||||
self.remote_impl = infra.remote.SSHRemote
|
||||
|
||||
self.pubhost = self.pubhost[0] if self.pubhost else self.host
|
||||
|
||||
def __hash__(self):
|
||||
|
@ -188,10 +190,9 @@ class Node:
|
|||
f.write("fi\n")
|
||||
|
||||
print("")
|
||||
phost = "localhost" if self.host.startswith("127.") else self.host
|
||||
print(
|
||||
"================= Please run the below command on "
|
||||
+ phost
|
||||
+ self.host
|
||||
+ " and press enter to continue ================="
|
||||
)
|
||||
print("")
|
||||
|
|
|
@ -78,7 +78,7 @@ def run(get_command, args):
|
|||
|
||||
hosts = args.nodes
|
||||
if not hosts:
|
||||
hosts = ["localhost"] * minimum_number_of_local_nodes(args)
|
||||
hosts = ["local://localhost"] * minimum_number_of_local_nodes(args)
|
||||
|
||||
LOG.info("Starting nodes on {}".format(hosts))
|
||||
|
||||
|
|
|
@ -146,10 +146,8 @@ def assert_recovery_shares_update(func, network, args, **kwargs):
|
|||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost"] * (4 if args.consensus == "bft" else 2)
|
||||
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
) as network:
|
||||
network.start_and_join(args)
|
||||
primary, _ = network.find_primary()
|
||||
|
@ -328,7 +326,7 @@ def run(args):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
args = infra.e2e_args.cli_args()
|
||||
args.package = args.app_script and "liblua_generic" or "liblogging"
|
||||
args.nodes = infra.e2e_args.min_nodes(args, f=1)
|
||||
run(args)
|
||||
|
|
|
@ -352,10 +352,8 @@ def test_npm_tsoa_app(network, args):
|
|||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost"] * (3 if args.consensus == "bft" else 2)
|
||||
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
) as network:
|
||||
network.start_and_join(args)
|
||||
network = test_module_set_and_remove(network, args)
|
||||
|
@ -370,4 +368,5 @@ if __name__ == "__main__":
|
|||
|
||||
args = infra.e2e_args.cli_args()
|
||||
args.package = "libjs_generic"
|
||||
args.nodes = infra.e2e_args.max_nodes(args, f=0)
|
||||
run(args)
|
||||
|
|
|
@ -52,10 +52,8 @@ def test(network, args):
|
|||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost"] * (4 if args.consensus == "bft" else 2)
|
||||
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
) as network:
|
||||
network.start_and_join(args)
|
||||
test(network, args)
|
||||
|
@ -65,5 +63,5 @@ if __name__ == "__main__":
|
|||
|
||||
args = infra.e2e_args.cli_args()
|
||||
args.package = args.app_script or "liblogging"
|
||||
|
||||
args.nodes = infra.e2e_args.max_nodes(args, f=0)
|
||||
run(args)
|
||||
|
|
|
@ -45,7 +45,7 @@ def check_can_progress(node, timeout=3):
|
|||
|
||||
@reqs.description("Adding a valid node from primary")
|
||||
def test_add_node(network, args):
|
||||
new_node = network.create_and_trust_node(args.package, "localhost", args)
|
||||
new_node = network.create_and_trust_node(args.package, "local://localhost", args)
|
||||
with new_node.client() as c:
|
||||
s = c.get("/node/state")
|
||||
assert s.body.json()["id"] == new_node.node_id
|
||||
|
@ -58,7 +58,7 @@ def test_add_node(network, args):
|
|||
def test_add_node_from_backup(network, args):
|
||||
backup = network.find_any_backup()
|
||||
new_node = network.create_and_trust_node(
|
||||
args.package, "localhost", args, target_node=backup
|
||||
args.package, "local://localhost", args, target_node=backup
|
||||
)
|
||||
assert new_node
|
||||
return network
|
||||
|
@ -70,7 +70,7 @@ def test_add_node_from_backup(network, args):
|
|||
def test_add_node_from_snapshot(network, args, copy_ledger_read_only=True):
|
||||
new_node = network.create_and_trust_node(
|
||||
args.package,
|
||||
"localhost",
|
||||
"local://localhost",
|
||||
args,
|
||||
from_snapshot=True,
|
||||
copy_ledger_read_only=copy_ledger_read_only,
|
||||
|
@ -89,7 +89,7 @@ def test_add_as_many_pending_nodes(network, args):
|
|||
)
|
||||
|
||||
for _ in range(number_new_nodes):
|
||||
network.create_and_add_pending_node(args.package, "localhost", args)
|
||||
network.create_and_add_pending_node(args.package, "local://localhost", args)
|
||||
check_can_progress(network.find_primary()[0])
|
||||
return network
|
||||
|
||||
|
@ -101,7 +101,7 @@ def test_add_node_untrusted_code(network, args):
|
|||
code_not_found_exception = None
|
||||
try:
|
||||
network.create_and_add_pending_node(
|
||||
"liblua_generic", "localhost", args, timeout=3
|
||||
"liblua_generic", "local://localhost", args, timeout=3
|
||||
)
|
||||
except infra.network.CodeIdNotFound as err:
|
||||
code_not_found_exception = err
|
||||
|
@ -143,11 +143,14 @@ def test_retire_primary(network, args):
|
|||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost", "localhost"]
|
||||
|
||||
txs = app.LoggingTxs()
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb, txs=txs
|
||||
args.nodes,
|
||||
args.binary_dir,
|
||||
args.debug_nodes,
|
||||
args.perf_nodes,
|
||||
pdb=args.pdb,
|
||||
txs=txs,
|
||||
) as network:
|
||||
network.start_and_join(args)
|
||||
|
||||
|
@ -175,4 +178,5 @@ if __name__ == "__main__":
|
|||
|
||||
args = infra.e2e_args.cli_args()
|
||||
args.package = args.app_script and "liblua_generic" or "liblogging"
|
||||
args.nodes = infra.e2e_args.max_nodes(args, f=0)
|
||||
run(args)
|
||||
|
|
|
@ -26,7 +26,7 @@ def test(network, args, from_snapshot=False):
|
|||
defunct_network_enc_pubk = network.store_current_network_encryption_key()
|
||||
|
||||
recovered_network = infra.network.Network(
|
||||
network.hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, network
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, network
|
||||
)
|
||||
|
||||
recovered_network.start_in_recovery(
|
||||
|
@ -51,7 +51,7 @@ def test_share_resilience(network, args, from_snapshot=False):
|
|||
defunct_network_enc_pubk = network.store_current_network_encryption_key()
|
||||
|
||||
recovered_network = infra.network.Network(
|
||||
network.hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, network
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, network
|
||||
)
|
||||
recovered_network.start_in_recovery(args, ledger_dir, snapshot_dir)
|
||||
primary, _ = recovered_network.find_primary()
|
||||
|
@ -104,12 +104,15 @@ def test_share_resilience(network, args, from_snapshot=False):
|
|||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost", "localhost", "localhost"]
|
||||
|
||||
txs = app.LoggingTxs()
|
||||
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb, txs=txs
|
||||
args.nodes,
|
||||
args.binary_dir,
|
||||
args.debug_nodes,
|
||||
args.perf_nodes,
|
||||
pdb=args.pdb,
|
||||
txs=txs,
|
||||
) as network:
|
||||
network.start_and_join(args)
|
||||
|
||||
|
@ -154,5 +157,6 @@ checked. Note that the key for each logging message is unique (per table).
|
|||
|
||||
args = infra.e2e_args.cli_args(add)
|
||||
args.package = "liblogging"
|
||||
args.nodes = infra.e2e_args.min_nodes(args, f=1)
|
||||
|
||||
run(args)
|
||||
|
|
|
@ -16,10 +16,8 @@ def test(network, args):
|
|||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost", "localhost"]
|
||||
|
||||
with infra.network.network(
|
||||
hosts,
|
||||
args.nodes,
|
||||
args.binary_dir,
|
||||
args.debug_nodes,
|
||||
args.perf_nodes,
|
||||
|
@ -47,4 +45,5 @@ if __name__ == "__main__":
|
|||
|
||||
args = infra.e2e_args.cli_args()
|
||||
args.package = args.app_script and "liblua_generic" or "liblogging"
|
||||
args.nodes = infra.e2e_args.max_nodes(args, f=0)
|
||||
run(args)
|
||||
|
|
|
@ -23,10 +23,8 @@ def test_suspend_primary(network, args):
|
|||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost", "localhost"]
|
||||
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
) as network:
|
||||
network.start_and_join(args)
|
||||
|
||||
|
@ -42,7 +40,7 @@ def run(args):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
args = infra.e2e_args.cli_args()
|
||||
args.package = args.app_script and "liblua_generic" or "liblogging"
|
||||
args.nodes = infra.e2e_args.max_nodes(args, f=0)
|
||||
run(args)
|
||||
|
|
|
@ -14,7 +14,6 @@ from loguru import logger as LOG
|
|||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost"] * (4 if args.consensus == "bft" else 2)
|
||||
os.makedirs(args.schema_dir, exist_ok=True)
|
||||
|
||||
changed_files = []
|
||||
|
@ -67,7 +66,7 @@ def run(args):
|
|||
return True
|
||||
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes
|
||||
) as network:
|
||||
network.start_and_join(args)
|
||||
primary, _ = network.find_primary()
|
||||
|
@ -133,4 +132,5 @@ if __name__ == "__main__":
|
|||
)
|
||||
|
||||
args = infra.e2e_args.cli_args(add=add)
|
||||
args.nodes = ["local://localhost"]
|
||||
run(args)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"hosts": [
|
||||
"localhost",
|
||||
"localhost"
|
||||
"local://localhost",
|
||||
"local://localhost"
|
||||
],
|
||||
"package": "liblogging",
|
||||
"connections": [
|
||||
|
|
|
@ -9,7 +9,7 @@ import os
|
|||
from loguru import logger as LOG
|
||||
|
||||
|
||||
DEFAULT_NODES = ["127.0.0.1:8000"]
|
||||
DEFAULT_NODES = ["local://127.0.0.1:8000"]
|
||||
|
||||
|
||||
def dump_network_info(path, network, node):
|
||||
|
@ -119,7 +119,7 @@ if __name__ == "__main__":
|
|||
parser.add_argument(
|
||||
"-n",
|
||||
"--node",
|
||||
help=f"List of hostnames[,pub_hostnames:ports]. Default is {DEFAULT_NODES}",
|
||||
help=f"List of (local://|ssh://)hostnames[,pub_hostnames:ports]. Default is {DEFAULT_NODES}",
|
||||
action="append",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
|
|
@ -20,18 +20,15 @@ def test(network, args):
|
|||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost"]
|
||||
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
) as network:
|
||||
network.start_and_join(args)
|
||||
test(network, args)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
args = infra.e2e_args.cli_args()
|
||||
args.package = args.app_script or "liblogging"
|
||||
|
||||
args.nodes = ["local://localhost"]
|
||||
run(args)
|
||||
|
|
|
@ -20,13 +20,11 @@ def print_memory_stats(node, shutdown_event):
|
|||
|
||||
|
||||
def run(args, additional_attack_args):
|
||||
hosts = ["localhost", "localhost", "localhost"]
|
||||
|
||||
# Test that vegeta is available
|
||||
subprocess.run([VEGETA_BIN, "-version"], capture_output=True, check=True)
|
||||
|
||||
with infra.network.network(
|
||||
hosts,
|
||||
args.nodes,
|
||||
args.binary_dir,
|
||||
args.debug_nodes,
|
||||
args.perf_nodes,
|
||||
|
@ -112,4 +110,5 @@ if __name__ == "__main__":
|
|||
|
||||
args, unknown_args = infra.e2e_args.cli_args(add=add, accept_unknown=True)
|
||||
args.package = "liblogging"
|
||||
args.nodes = infra.e2e_args.min_nodes(args, f=1)
|
||||
run(args, unknown_args)
|
||||
|
|
|
@ -47,18 +47,15 @@ def test(network, args):
|
|||
|
||||
|
||||
def run(args):
|
||||
hosts = ["localhost"] * (4 if args.consensus == "bft" else 2)
|
||||
|
||||
with infra.network.network(
|
||||
hosts, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
args.nodes, args.binary_dir, args.debug_nodes, args.perf_nodes, pdb=args.pdb
|
||||
) as network:
|
||||
network.start_and_join(args)
|
||||
test(network, args)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
args = infra.e2e_args.cli_args()
|
||||
args.package = args.app_script or "liblogging"
|
||||
|
||||
args.nodes = infra.e2e_args.max_nodes(args, f=0)
|
||||
run(args)
|
||||
|
|
Загрузка…
Ссылка в новой задаче