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

Try cached tempest octavia test_server.bin #1267

Merged
Merged
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
26 changes: 18 additions & 8 deletions zaza/openstack/charm_tests/tempest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from pathlib import Path
import shutil
import subprocess
import tempfile
import urllib.parse

from neutronclient.common import exceptions as neutronexceptions
Expand Down Expand Up @@ -379,15 +380,24 @@ def _add_octavia_config(ctxt, missing_fatal=True):
:rtype: None
:raises: subprocess.CalledProcessError
"""
cachedir = tempfile.gettempdir()
local_path = os.path.join(cachedir, 'test_server.bin')
workspace_path = os.path.join(ctxt['workspace_path'], 'test_server.bin')
if not os.path.exists(local_path):
subprocess.check_call([
'curl',
"{}:80/swift/v1/fixtures/test_server.bin".format(
ctxt['test_swift_ip']),
'-o', workspace_path
])
shutil.copy(workspace_path, cachedir)
else:
logging.info("Found octavia tempest test test_server.bin in local "
"cache ({}) - skipping download".format(local_path))
shutil.copy(local_path, workspace_path)

subprocess.check_call([
'curl',
"{}:80/swift/v1/fixtures/test_server.bin".format(
ctxt['test_swift_ip']),
'-o', "{}/test_server.bin".format(ctxt['workspace_path'])
])
subprocess.check_call([
'chmod', '+x',
"{}/test_server.bin".format(ctxt['workspace_path'])
'chmod', '+x', workspace_path
])


Expand Down
Loading