Hotfix tests because changed separator in last PR.

This commit is contained in:
Alberto Soutullo 2023-03-21 20:21:47 +01:00 committed by Alberto
parent ef3980d230
commit d8e5067c93
7 changed files with 28 additions and 28 deletions

View File

@ -18,9 +18,9 @@ def instantiate_services(plan, network_topology, testing):
"peer_id" : peer id of the node, as string,
"ip_address": ip of the container that has the node, as string
"ports": {
"rpc_node_0": (port_number, port_protocol)
"libp2p_node_0": (port_number, port_protocol),
"prometheus_node_0": (port_number, port_protocol)
"rpc-node_0": (port_number, port_protocol)
"libp2p-node_0": (port_number, port_protocol),
"prometheus-node_0": (port_number, port_protocol)
}
},
"node_1": {...}

View File

@ -23,13 +23,13 @@ def test_prepare_gowaku_service(plan):
assertion="==", target_value=vars.GOWAKU_IMAGE)
for node in ["test1", "test2"]:
plan.assert(value=str(test_dict["id_1"].ports[vars.RPC_PORT_ID+"_"+node].number),
plan.assert(value=str(test_dict["id_1"].ports[vars.RPC_PORT_ID+vars.ID_STR_SEPARATOR+node].number),
assertion="==", target_value = str(vars.WAKU_RPC_PORT_NUMBER +
topology["nodes"][node][vars.GENNET_PORT_SHIFT_KEY]))
plan.assert(value=str(test_dict["id_1"].ports[vars.PROMETHEUS_PORT_ID+"_"+node].number),
plan.assert(value=str(test_dict["id_1"].ports[vars.PROMETHEUS_PORT_ID+vars.ID_STR_SEPARATOR+node].number),
assertion="==", target_value=str(vars.PROMETHEUS_PORT_NUMBER +
topology["nodes"][node][vars.GENNET_PORT_SHIFT_KEY]))
plan.assert(value=str(test_dict["id_1"].ports[vars.WAKU_LIBP2P_PORT_ID+"_"+node].number),
plan.assert(value=str(test_dict["id_1"].ports[vars.WAKU_LIBP2P_PORT_ID+vars.ID_STR_SEPARATOR+node].number),
assertion="==", target_value=str(vars.WAKU_LIBP2P_PORT +
topology["nodes"][node][vars.GENNET_PORT_SHIFT_KEY]))

View File

@ -22,13 +22,13 @@ def test_prepare_nwaku_service(plan):
assertion="==", target_value=vars.NWAKU_IMAGE)
for node in ["test1", "test2"]:
plan.assert(value=str(test_dict["id_1"].ports[vars.RPC_PORT_ID+"_"+node].number),
plan.assert(value=str(test_dict["id_1"].ports[vars.RPC_PORT_ID+vars.ID_STR_SEPARATOR+node].number),
assertion="==", target_value = str(vars.WAKU_RPC_PORT_NUMBER +
topology["nodes"][node][vars.GENNET_PORT_SHIFT_KEY]))
plan.assert(value=str(test_dict["id_1"].ports[vars.PROMETHEUS_PORT_ID+"_"+node].number),
plan.assert(value=str(test_dict["id_1"].ports[vars.PROMETHEUS_PORT_ID+vars.ID_STR_SEPARATOR+node].number),
assertion="==", target_value=str(vars.PROMETHEUS_PORT_NUMBER +
topology["nodes"][node][vars.GENNET_PORT_SHIFT_KEY]))
plan.assert(value=str(test_dict["id_1"].ports[vars.WAKU_LIBP2P_PORT_ID+"_"+node].number),
plan.assert(value=str(test_dict["id_1"].ports[vars.WAKU_LIBP2P_PORT_ID+vars.ID_STR_SEPARATOR+node].number),
assertion="==", target_value=str(vars.WAKU_LIBP2P_PORT +
topology["nodes"][node][vars.GENNET_PORT_SHIFT_KEY]))

View File

@ -11,13 +11,13 @@ def test_prepare_waku_ports_in_service(plan):
ports = waku_builders.prepare_waku_ports_in_service(["test1", "test2"], topology)
for node_name in ["test1", "test2"]:
plan.assert(value=str(ports[vars.RPC_PORT_ID+"_"+node_name].number),
plan.assert(value=str(ports[vars.RPC_PORT_ID+vars.ID_STR_SEPARATOR+node_name].number),
assertion="==", target_value = str(vars.WAKU_RPC_PORT_NUMBER +
topology["nodes"][node_name][vars.GENNET_PORT_SHIFT_KEY]))
plan.assert(value=str(ports[vars.PROMETHEUS_PORT_ID+"_"+node_name].number),
plan.assert(value=str(ports[vars.PROMETHEUS_PORT_ID+vars.ID_STR_SEPARATOR+node_name].number),
assertion="==", target_value=str(vars.PROMETHEUS_PORT_NUMBER +
topology["nodes"][node_name][vars.GENNET_PORT_SHIFT_KEY]))
plan.assert(value=str(ports[vars.WAKU_LIBP2P_PORT_ID+"_"+node_name].number),
plan.assert(value=str(ports[vars.WAKU_LIBP2P_PORT_ID+vars.ID_STR_SEPARATOR+node_name].number),
assertion="==", target_value=str(vars.WAKU_LIBP2P_PORT +
topology["nodes"][node_name][vars.GENNET_PORT_SHIFT_KEY]))
@ -33,9 +33,9 @@ def test_prepare_waku_config_files_in_service(plan):
def test_add_waku_ports_info_to_topology(plan):
network_topology = {"nodes": {"test1": {}, "test2": {}}}
service_struct_1 = struct(ports={vars.RPC_PORT_ID+"_test1": PortSpec(number=1),
vars.WAKU_LIBP2P_PORT_ID+"_test1": PortSpec(number=2),
vars.PROMETHEUS_PORT_ID+"_test1": PortSpec(number=3)})
service_struct_1 = struct(ports={vars.RPC_PORT_ID+"-test1": PortSpec(number=1),
vars.WAKU_LIBP2P_PORT_ID+"-test1": PortSpec(number=2),
vars.PROMETHEUS_PORT_ID+"-test1": PortSpec(number=3)})
node_info1 = {vars.GENNET_NODE_CONTAINER_KEY: "cid1"}
@ -43,9 +43,9 @@ def test_add_waku_ports_info_to_topology(plan):
waku_builders.add_waku_ports_info_to_topology(network_topology, services, node_info1, "test1")
plan.assert(value=str(network_topology["nodes"]["test1"]["ports"][vars.RPC_PORT_ID+"_test1"][0]),
plan.assert(value=str(network_topology["nodes"]["test1"]["ports"][vars.RPC_PORT_ID+"-test1"][0]),
assertion="==", target_value=str(1))
plan.assert(value=str(network_topology["nodes"]["test1"]["ports"][vars.WAKU_LIBP2P_PORT_ID+"_test1"][0]),
plan.assert(value=str(network_topology["nodes"]["test1"]["ports"][vars.WAKU_LIBP2P_PORT_ID+"-test1"][0]),
assertion="==", target_value=str(2))
plan.assert(value=str(network_topology["nodes"]["test1"]["ports"][vars.PROMETHEUS_PORT_ID+"_test1"][0]),
plan.assert(value=str(network_topology["nodes"]["test1"]["ports"][vars.PROMETHEUS_PORT_ID+"-test1"][0]),
assertion="==", target_value=str(3))

View File

@ -21,7 +21,7 @@ def test_get_toml_configuration_artifact_same_config_false(plan):
def test_generate_template_node_targets_single(plan):
network_topology={"nodes": {"test1":{"ip_address": "1.1.1.1",
"ports": { "rpc_test1": (80, 'tcp')}}}}
"ports": { "rpc-test1": (80, 'tcp')}}}}
template_data = files.generate_template_node_targets(network_topology, "rpc", "targets")
@ -29,8 +29,8 @@ def test_generate_template_node_targets_single(plan):
def test_generate_template_node_targets_multiple(plan):
network_topology={"nodes": {"test1":{"ip_address": "1.1.1.1", "ports": { "rpc_test1": (80, 'tcp')}},
"test2":{"ip_address": "2.2.2.2", "ports": { "rpc_test2": (10, 'tcp')}}}}
network_topology={"nodes": {"test1":{"ip_address": "1.1.1.1", "ports": { "rpc-test1": (80, 'tcp')}},
"test2":{"ip_address": "2.2.2.2", "ports": { "rpc-test2": (10, 'tcp')}}}}
template_data = files.generate_template_node_targets(network_topology, "rpc", "targets")

View File

@ -43,20 +43,20 @@ def test_send_json_rpc(plan, test_node, test_node_info):
service_id = test_node_info[vars.GENNET_NODE_CONTAINER_KEY]
# Automatically waits for 200
call_protocols.send_json_rpc(plan, service_id, vars.RPC_PORT_ID+"_"+test_node,
call_protocols.send_json_rpc(plan, service_id, vars.RPC_PORT_ID+vars.ID_STR_SEPARATOR+test_node,
vars.POST_RELAY_MESSAGE_METHOD, params)
def test_get_wakunode_peer_id(plan, test_node, test_node_info, expected_ids):
service_id = test_node_info[vars.GENNET_NODE_CONTAINER_KEY]
peer_id = waku.get_wakunode_peer_id(plan, service_id, vars.RPC_PORT_ID+"_"+test_node)
peer_id = waku.get_wakunode_peer_id(plan, service_id, vars.RPC_PORT_ID+vars.ID_STR_SEPARATOR+test_node)
plan.print("Peer ID for " + test_node + ": " + peer_id)
plan.assert(value=peer_id, assertion="==", target_value=expected_ids[test_node])
def test_create_node_multiaddress(plan):
node_id = "test"
node_information = {"ip_address": "1.1.1.1", "ports": {"libp2p_test": (1234, 'tcp')},
node_information = {"ip_address": "1.1.1.1", "ports": {"libp2p-test": (1234, 'tcp')},
"peer_id": "ASDFGHJKL"}
waku_id = waku.create_node_multiaddress(node_id, node_information)

View File

@ -173,11 +173,11 @@ class TestWLS(unittest.TestCase):
self.assertFalse(next_message)
def test__select_emitter_and_topic(self):
emitters = {"test1": {"ip_address": 1, "ports": {"rpc_test1": (2, "asd")},
emitters = {"test1": {"ip_address": 1, "ports": {"rpc-test1": (2, "asd")},
"topics": ["test1a", "test1b"]},
"test2": {"ip_address": 5, "ports": {"rpc_test2": (6, "tcp")},
"test2": {"ip_address": 5, "ports": {"rpc-test2": (6, "tcp")},
"topics": ["test2a", "test2b"]},
"test3": {"ip_address": 10, "ports": {"rpc_test3": (11, "tcp")},
"test3": {"ip_address": 10, "ports": {"rpc-test3": (11, "tcp")},
"topics": ["test3a", "test3b"]}}
emitter_address, topic = wls._select_emitter_with_topic(emitters)