Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No rest #28

Merged
merged 2 commits into from
Feb 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions lib/topology_docker_openswitch/openswitch_setup
Original file line number Diff line number Diff line change
Expand Up @@ -277,37 +277,6 @@ def main():
'hostname was not set'
)

info('Checking restd service status...')
output = ''
try:
output = check_output(
'systemctl status restd', shell=True
)
except CalledProcessError as e:
pass
if 'Active: active' not in output:
try:
info('Starting restd daemon.')
check_output('systemctl start restd', shell=True)

info('Checking restd service started.')
for i in range(0, config_timeout):
output = ''
output = check_output(
'systemctl status restd', shell=True
)
if 'Active: active' not in output:
sleep(0.1)
else:
break
else:
raise Exception("Failed to start restd service")

except CalledProcessError as e:
raise Exception(
'Failed to start restd: {}'.format(e.output)
)


if __name__ == '__main__':
main()
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,26 @@ def pytest_runtest_teardown(item):
FIXME: document the item argument
"""
test_suite = splitext(basename(item.parent.name))[0]
path_name = '/tmp/topology/docker/{}_{}_{}'.format(
test_suite, item.name, datetime.now().strftime('%Y_%m_%d_%H_%M_%S')
)

# Being extra-prudent here
if exists(path_name):
rmtree(path_name)
from pytest import config

topology_log_dir = config.getoption('--topology-log-dir')

if not topology_log_dir:
return
else:
path_name = join(
topology_log_dir,
'{}_{}_{}'.format(
test_suite,
item.name,
datetime.now().strftime('%Y_%m_%d_%H_%M_%S')
)
)

# Being extra-prudent here
if exists(path_name):
rmtree(path_name)

if 'topology' not in item.funcargs:
from topology_docker_openswitch.openswitch import LOG_PATHS
Expand Down Expand Up @@ -99,14 +112,14 @@ def pytest_runtest_teardown(item):
core_path = '/var/diagnostics/coredump'

bash_shell.send_command(
'ls -1 {}/core.* 2>/dev/null'.format(core_path), silent=True
'ls -1 {}/core* 2>/dev/null'.format(core_path), silent=True
)

core_files = bash_shell.get_response(silent=True).splitlines()

for core_file in core_files:
bash_shell.send_command(
'cp {core_path}/{core_file} /tmp'.format(**locals()),
'cp {core_file} /tmp'.format(**locals()),
silent=True
)
except:
Expand Down
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ def find_requirements(filename):

# Entry points
entry_points={
'pytest11': ['topology_docker_openswitch '
'= topology_docker_openswitch.plugin.plugin'],
'pytest11': [
'topology_docker_openswitch '
'= topology_docker_openswitch.pytest.plugin'
],
'topology_docker_node_10': [
'openswitch = topology_docker_openswitch.openswitch:OpenSwitch'
]
Expand Down