Commit 13eaae63 authored by leoporoli's avatar leoporoli Committed by GitHub

chore: switched to Starlark named arguments in exec, request and wait calls (#84)

parent 4df80a5c
......@@ -85,7 +85,7 @@ def run(plan, args):
"finalized_epoch": ".data.finalized.epoch"
}
)
plan.wait(epoch_recipe, "extract.finalized_epoch", "!=", "0", timeout="40m", service_name = first_client_beacon_name)
plan.wait(recipe = epoch_recipe, field = "extract.finalized_epoch", assertion = "!=", target_value = "0", timeout = "40m", service_name = first_client_beacon_name)
plan.print("First finalized epoch occurred successfully")
......
......@@ -3,4 +3,4 @@ def wait_for_healthy(plan, service_name, port_id):
endpoint = "/eth/v1/node/health",
port_id = port_id
)
return plan.wait(recipe, "code", "IN", [200, 206, 503], timeout = "15m", service_name = service_name)
return plan.wait(recipe = recipe, field = "code", assertion = "IN", target_value = [200, 206, 503], timeout = "15m", service_name = service_name)
......@@ -124,7 +124,7 @@ def launch(
"enr": ".data.enr"
}
)
beacon_node_enr = plan.request(beacon_node_identity_recipe, service_name = beacon_node_service_name)["extract.enr"]
beacon_node_enr = plan.request(recipe = beacon_node_identity_recipe, service_name = beacon_node_service_name)["extract.enr"]
beacon_metrics_port = beacon_service.ports[BEACON_METRICS_PORT_ID]
beacon_metrics_url = "{0}:{1}".format(beacon_service.ip_address, beacon_metrics_port.number)
......
......@@ -111,7 +111,7 @@ def launch(
"enr": ".data.enr"
}
)
beacon_node_enr = plan.request(beacon_node_identity_recipe, service_name = beacon_node_service_name)["extract.enr"]
beacon_node_enr = plan.request(recipe = beacon_node_identity_recipe, service_name = beacon_node_service_name)["extract.enr"]
beacon_metrics_port = beacon_service.ports[METRICS_PORT_ID]
beacon_metrics_url = "{0}:{1}".format(beacon_service.ip_address, beacon_metrics_port.number)
......
......@@ -90,7 +90,7 @@ def launch(
"enr": ".data.enr"
}
)
node_enr = plan.request(cl_node_identity_recipe, service_name = service_name)["extract.enr"]
node_enr = plan.request(recipe = cl_node_identity_recipe, service_name = service_name)["extract.enr"]
metrics_port = nimbus_service.ports[METRICS_PORT_ID]
metrics_url = "{0}:{1}".format(nimbus_service.ip_address, metrics_port.number)
......
......@@ -136,7 +136,7 @@ def launch(
"enr": ".data.enr"
}
)
beacon_node_enr = plan.request(beacon_node_identity_recipe, service_name = beacon_node_service_name)["extract.enr"]
beacon_node_enr = plan.request(recipe = beacon_node_identity_recipe, service_name = beacon_node_service_name)["extract.enr"]
beacon_metrics_port = beacon_service.ports[BEACON_MONITORING_PORT_ID]
beacon_metrics_url = "{0}:{1}".format(beacon_service.ip_address, beacon_metrics_port.number)
......
......@@ -97,7 +97,7 @@ def launch(
"enr": ".data.enr"
}
)
node_enr = plan.request(node_identity_recipe, service_name = service_name)["extract.enr"]
node_enr = plan.request(recipe = node_identity_recipe, service_name = service_name)["extract.enr"]
teku_metrics_port = teku_service.ports[METRICS_PORT_ID]
......
......@@ -10,7 +10,7 @@ def get_enode_enr_for_node(plan, service_name, port_id):
"enr": ".result.enr",
}
)
response = plan.wait(recipe, "extract.enode", "!=", "", timeout = "15m", service_name = service_name)
response = plan.wait(recipe = recipe, field = "extract.enode", assertion = "!=", target_value = "", timeout = "15m", service_name = service_name)
return (response["extract.enode"], response["extract.enr"])
def get_enode_for_node(plan, service_name, port_id):
......@@ -23,5 +23,5 @@ def get_enode_for_node(plan, service_name, port_id):
"enode": ".result.enode",
}
)
response = plan.wait(recipe, "extract.enode", "!=", "", timeout = "15m", service_name = service_name)
response = plan.wait(recipe = recipe, field = "extract.enode", assertion = "!=", target_value = "", timeout = "15m", service_name = service_name)
return response["extract.enode"]
......@@ -83,7 +83,7 @@ def generate_cl_genesis_data(
(" && ").join(all_dirpath_creation_commands),
]
dir_creation_cmd_result = plan.exec(ExecRecipe(command=dir_creation_cmd), service_name=launcher_service_name)
dir_creation_cmd_result = plan.exec(recipe=ExecRecipe(command=dir_creation_cmd), service_name=launcher_service_name)
plan.assert(dir_creation_cmd_result["code"], "==", SUCCESSFUL_EXEC_CMD_EXIT_CODE)
......@@ -100,7 +100,7 @@ def generate_cl_genesis_data(
filepath_on_generator,
OUTPUT_DIRPATH_ON_GENERATOR,
]
cmd_result = plan.exec(ExecRecipe( command=cmd), service_name=launcher_service_name)
cmd_result = plan.exec(recipe=ExecRecipe( command=cmd), service_name=launcher_service_name)
plan.assert(cmd_result["code"], "==", SUCCESSFUL_EXEC_CMD_EXIT_CODE)
# Generate files that need dynamic content
......@@ -118,7 +118,7 @@ def generate_cl_genesis_data(
destFilepath,
)
]
cmd_result = plan.exec(ExecRecipe( command=cmd), service_name=launcher_service_name)
cmd_result = plan.exec(recipe=ExecRecipe( command=cmd), service_name=launcher_service_name)
plan.assert(cmd_result["code"], "==", SUCCESSFUL_EXEC_CMD_EXIT_CODE)
......@@ -132,7 +132,7 @@ def generate_cl_genesis_data(
"--state-output", shared_utils.path_join(OUTPUT_DIRPATH_ON_GENERATOR, GENESIS_STATE_FILENAME)
]
genesis_generation_result = plan.exec(ExecRecipe(command=cl_genesis_generation_cmd), service_name=launcher_service_name)
genesis_generation_result = plan.exec(recipe=ExecRecipe(command=cl_genesis_generation_cmd), service_name=launcher_service_name)
plan.assert(genesis_generation_result["code"], "==", SUCCESSFUL_EXEC_CMD_EXIT_CODE)
cl_genesis_data_artifact_name = plan.store_service_files(launcher_service_name, OUTPUT_DIRPATH_ON_GENERATOR, name = "cl-genesis-data")
......
......@@ -66,7 +66,7 @@ def generate_cl_validator_keystores(
command_str = " && ".join(all_sub_command_strs)
command_result = plan.exec(ExecRecipe(command=["sh", "-c", command_str]), service_name=service_name)
command_result = plan.exec(recipe=ExecRecipe(command=["sh", "-c", command_str]), service_name=service_name)
plan.assert(command_result["code"], "==", SUCCESSFUL_EXEC_CMD_EXIT_CODE)
# Store outputs into files artifacts
......@@ -97,7 +97,7 @@ def generate_cl_validator_keystores(
PRYSM_PASSWORD_FILEPATH_ON_GENERATOR,
),
]
write_prysm_password_file_cmd_result = plan.exec(ExecRecipe(command=write_prysm_password_file_cmd), service_name=service_name)
write_prysm_password_file_cmd_result = plan.exec(recipe=ExecRecipe(command=write_prysm_password_file_cmd), service_name=service_name)
plan.assert(write_prysm_password_file_cmd_result["code"], "==", SUCCESSFUL_EXEC_CMD_EXIT_CODE)
prysm_password_artifact_name = plan.store_service_files(service_name, PRYSM_PASSWORD_FILEPATH_ON_GENERATOR, name = "prysm-password")
......
......@@ -80,7 +80,7 @@ def generate_el_genesis_data(
]
dir_creation_cmd_result = plan.exec(ExecRecipe(command=dir_creation_cmd), service_name=launcher_service_name)
dir_creation_cmd_result = plan.exec(recipe=ExecRecipe(command=dir_creation_cmd), service_name=launcher_service_name)
plan.assert(dir_creation_cmd_result["code"], "==", SUCCESSFUL_EXEC_CMD_EXIT_CODE)
genesis_config_filepath_on_generator = shared_utils.path_join(CONFIG_DIRPATH_ON_GENERATOR, GENESIS_CONFIG_FILENAME)
......@@ -96,7 +96,7 @@ def generate_el_genesis_data(
" ".join(cmd)
]
cmd_to_execute_result = plan.exec(ExecRecipe(command=cmd_to_execute), service_name=launcher_service_name)
cmd_to_execute_result = plan.exec(recipe=ExecRecipe(command=cmd_to_execute), service_name=launcher_service_name)
plan.assert(cmd_to_execute_result["code"], "==", SUCCESSFUL_EXEC_CMD_EXIT_CODE)
......@@ -115,7 +115,7 @@ def generate_el_genesis_data(
)
]
jwt_secret_generation_cmd_result = plan.exec(ExecRecipe(command=jwt_secret_generation_cmd), service_name=launcher_service_name)
jwt_secret_generation_cmd_result = plan.exec(recipe=ExecRecipe(command=jwt_secret_generation_cmd), service_name=launcher_service_name)
plan.assert(jwt_secret_generation_cmd_result["code"], "==", SUCCESSFUL_EXEC_CMD_EXIT_CODE)
el_genesis_data_artifact_name = plan.store_service_files(launcher_service_name, OUTPUT_DIRPATH_ON_GENERATOR, name = "el-genesis-data")
......
......@@ -19,7 +19,7 @@ def run_synchronous_testnet_verification(plan, params, el_client_contexts, cl_cl
plan.add_service(SERVICE_NAME, config)
command = get_cmd(params, el_client_contexts, cl_client_contexts, True)
exec_result = plan.exec(ExecRecipe(command=command), service_name=SERVICE_NAME)
exec_result = plan.exec(recipe=ExecRecipe(command=command), service_name=SERVICE_NAME)
plan.assert(exec_result["code"], "==", 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment