Skip to content

Commit

Permalink
Extract out args/instance_configs
Browse files Browse the repository at this point in the history
  • Loading branch information
lsankar4033 committed Aug 6, 2020
1 parent c1f9012 commit 8b8079d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
15 changes: 1 addition & 14 deletions lib/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
18 changes: 18 additions & 0 deletions lib/instance_configs.py
Original file line number Diff line number Diff line change
@@ -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
7 changes: 4 additions & 3 deletions lib/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import trio

from lib.console import ConsoleWriter
from lib.instance_configs import DEFAULT_ARGS

TESTS_DIR = 'scripts'

Expand All @@ -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'):
Expand All @@ -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)

0 comments on commit 8b8079d

Please sign in to comment.