Skip to content

Commit

Permalink
Try cached tempest octavia test_server.bin
Browse files Browse the repository at this point in the history
  • Loading branch information
dosaboy committed Sep 30, 2024
1 parent 4c1e106 commit 7f23c75
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 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,23 @@ def _add_octavia_config(ctxt, missing_fatal=True):
:rtype: None
:raises: subprocess.CalledProcessError
"""
subprocess.check_call([
'curl',
"{}:80/swift/v1/fixtures/test_server.bin".format(
ctxt['test_swift_ip']),
'-o', "{}/test_server.bin".format(ctxt['workspace_path'])
])
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:
shutil.copy(local_path, workspace_path)

subprocess.check_call([
'chmod', '+x',
"{}/test_server.bin".format(ctxt['workspace_path'])
"{}/test_server.bin".format(workspace_path)
])


Expand Down

0 comments on commit 7f23c75

Please sign in to comment.