Skip to content

Commit

Permalink
Merge pull request #1267 from dosaboy/try-local-testserverbin
Browse files Browse the repository at this point in the history
Try cached tempest octavia test_server.bin
  • Loading branch information
javacruft authored Oct 1, 2024
2 parents 4c1e106 + 84adfdb commit 853318b
Showing 1 changed file with 18 additions and 8 deletions.
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

0 comments on commit 853318b

Please sign in to comment.