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

Workaround the URL formatting issue for product streams #745

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 13 additions & 2 deletions zaza/openstack/charm_tests/glance_simplestreams_sync/tests.py
Expand Up @@ -43,7 +43,12 @@ def get_product_streams(url):
# metadata being written. Use tenacity to avoid this race.
client = requests.session()
json_data = client.get(url, verify=openstack_utils.get_cacert()).text
return json.loads(json_data)
try:
return json.loads(json_data)
except Exception as e:
logging.error("Couldn't decode json, reason: %s, response text to "
"decode:\n%s", str(e), json_data)
raise


class GlanceSimpleStreamsSyncTest(test_utils.OpenStackBaseTest):
Expand Down Expand Up @@ -112,7 +117,13 @@ def _check_local_product_streams(expected_images):
ps_interface = self.keystone_client.service_catalog.url_for(
service_type='product-streams', interface='publicURL'
)
url = "{}/{}".format(ps_interface, uri)
# the product-streams url registered seems to have added a '/' -
# for the test, ensure that the URL is formatted correctly with
# only 1 slash between the ps_interface URL and the uri
if ps_interface.endswith("/"):
url = "{}{}".format(ps_interface, uri)
else:
url = "{}/{}".format(ps_interface, uri)
logging.info('Retrieving product stream information'
' from {}'.format(url))
product_streams = get_product_streams(url)
Expand Down