From 8b8079ddb634e2093db2e1160c483fc6403a6b28 Mon Sep 17 00:00:00 2001 From: lsankar4033 Date: Wed, 5 Aug 2020 18:49:18 -0700 Subject: [PATCH] Extract out args/instance_configs --- lib/fixtures.py | 15 +-------------- lib/instance_configs.py | 18 ++++++++++++++++++ lib/runner.py | 7 ++++--- 3 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 lib/instance_configs.py diff --git a/lib/fixtures.py b/lib/fixtures.py index 0a314f1..b2b50a9 100644 --- a/lib/fixtures.py +++ b/lib/fixtures.py @@ -5,22 +5,9 @@ from sclients import SUPPORTED_CLIENTS, InstanceConfig, start_instance, stop_instance +from lib.instance_configs import DEFAULT_INSTANCE_CONFIG from lib.types import Fixture -DEFAULT_INSTANCE_CONFIG = { - 'beacon_state_path': 'ssz/single_client_genesis.ssz', - 'enr': { - 'enr': 'enr:-LK4QJCIZoViytOOmAzAbdOJODwQ36PhjXwvXlTFTloTzpawVpvPRmtrM6UZdPmOGck5yPZ9AbgmwyZnE3jm4jX0Yx0Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpBGMkSJAAAAAf__________gmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQOnBq2PcxFfkFACZvJz91cd-UKaTPtLv7zYJSJyAtq60YN0Y3CCIyiDdWRwgiMp', - 'private_key': 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', - 'udp': 9001, - 'tcp': 9000, - 'id': 'v4', - 'ip': '127.0.0.1', - 'attnets': '0x0000000000000000', - 'eth2': '0x4632448900000001ffffffffffffffff' - } -} - def extract_fixtures(clients_to_test=SUPPORTED_CLIENTS) -> List[Fixture]: fixtures = [] for client in SUPPORTED_CLIENTS: diff --git a/lib/instance_configs.py b/lib/instance_configs.py new file mode 100644 index 0000000..46a84de --- /dev/null +++ b/lib/instance_configs.py @@ -0,0 +1,18 @@ +# NOTE: we may have multiple configs here identified by name in the future + +DEFAULT_BEACON_STATE_PATH = 'ssz/default.ssz' +DEFAULT_ENR = { + 'enr': 'enr:-LK4QJCIZoViytOOmAzAbdOJODwQ36PhjXwvXlTFTloTzpawVpvPRmtrM6UZdPmOGck5yPZ9AbgmwyZnE3jm4jX0Yx0Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpBGMkSJAAAAAf__________gmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQOnBq2PcxFfkFACZvJz91cd-UKaTPtLv7zYJSJyAtq60YN0Y3CCIyiDdWRwgiMp', + 'private_key': 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', + 'udp': 9001, + 'tcp': 9000, + 'id': 'v4', + 'ip': '127.0.0.1', + 'attnets': '0x0000000000000000', + 'eth2': '0x4632448900000001ffffffffffffffff' +} +DEFAULT_INSTANCE_CONFIG = { + 'beacon_state_path': DEFAULT_BEACON_STATE_PATH, + 'enr': DEFAULT_ENR +} +DEFAULT_ARGS = DEFAULT_INSTANCE_CONFIG diff --git a/lib/runner.py b/lib/runner.py index 8232341..41621a9 100644 --- a/lib/runner.py +++ b/lib/runner.py @@ -5,6 +5,7 @@ import trio from lib.console import ConsoleWriter +from lib.instance_configs import DEFAULT_ARGS TESTS_DIR = 'scripts' @@ -24,8 +25,8 @@ def file_to_module(script): # TODO: add args back in -def run_module(module, cw): - print(f'Running module: {module}') +def run_module(module, args, cw): + print(f'Running module: {module} with args {args}') #module = importlib.import_module(module) #if not hasattr(module, 'run'): @@ -48,4 +49,4 @@ def run_all_tests(cw=ConsoleWriter(None, None), test_filter=None): if test_matches_filter(test_file, test_filter): cw = cw._replace(test=file_to_module(test_file)) - run_module(file_to_module(test_file), cw) + run_module(file_to_module(test_file), DEFAULT_ARGS, cw)