Skip to content

Commit

Permalink
Remove start/stop fixture commands + reuse flag on test
Browse files Browse the repository at this point in the history
  • Loading branch information
lsankar4033 committed Aug 19, 2020
1 parent a41983b commit 5261442
Showing 1 changed file with 2 additions and 32 deletions.
34 changes: 2 additions & 32 deletions steth.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,16 @@
from lib.runner import run_test_files, all_test_files, file_matches_filter
from lib.logging_tests import all_logging_test_files


def run_start_fixture_cmd(args):
client = args.client

fixtures = extract_fixtures([client])

for fixture in fixtures:
setup_fixture(fixture)


def run_stop_fixture_cmd(args):
for client in SUPPORTED_CLIENTS:
stop_instance(client)


def run_test_cmd(args):
clients = SUPPORTED_CLIENTS if args.client is None else [args.client]

reuse_clients = args.reuse
file_filter = args.only

test_files = [file for file in all_test_files() if file_matches_filter(file, file_filter)]
fixtures = extract_fixtures(clients)
failed = False
for fixture in fixtures:
if not reuse_clients:
setup_fixture(fixture)
setup_fixture(fixture)

try:
return_code = run_test_files(fixture.name, test_files, DEFAULT_ARGS)
Expand All @@ -48,8 +31,7 @@ def run_test_cmd(args):
failed = True

finally:
if not reuse_clients:
teardown_fixture(fixture)
teardown_fixture(fixture)
if failed:
exit(1)

Expand All @@ -70,22 +52,10 @@ def run_logging_test(args):
steth = argparse.ArgumentParser(description='Stethoscope tool for running multi-client Eth2 scenarios')
steth_sub = steth.add_subparsers()

fixture = steth_sub.add_parser('fixture', help='Manage fixtures of client instances')
fixture_sub = fixture.add_subparsers()

start = fixture_sub.add_parser('start')
start.add_argument(
'client', help=f'client to start. can only start 1 at a time until dynamic ENRs implemented. possible values: {SUPPORTED_CLIENTS}')
start.set_defaults(func=run_start_fixture_cmd)

stop = fixture_sub.add_parser('stop')
stop.set_defaults(func=run_stop_fixture_cmd)

test = steth_sub.add_parser('test', help='Run stethoscope unit tests')
test.add_argument('-c', '--client',
help=f'run test(s) for a specific client. possible values: {SUPPORTED_CLIENTS}')
test.add_argument('-o', '--only', help='run specific tests by name')
test.add_argument('-r', '--reuse', default=False, action='store_true', help='reuse running fixtures')
test.set_defaults(func=run_test_cmd)

test = steth_sub.add_parser('logging_test', help='Display example logs from ./steth.py test. Useful for testing CI integration')
Expand Down

0 comments on commit 5261442

Please sign in to comment.