Merge pull request #408 from ChrisMacNaughton/bug/374
Ensure that zaza-openstack-tests can talk to an IPv6 Keystone
This commit is contained in:
@@ -30,15 +30,3 @@ class TestOpenStackBaseTest(unittest.TestCase):
|
||||
|
||||
MyTestClass.setUpClass('foo', 'bar')
|
||||
_setUpClass.assert_called_with('foo', 'bar')
|
||||
|
||||
|
||||
class TestUtils(unittest.TestCase):
|
||||
|
||||
def test_format_addr(self):
|
||||
self.assertEquals('1.2.3.4', test_utils.format_addr('1.2.3.4'))
|
||||
self.assertEquals(
|
||||
'[2001:db8::42]', test_utils.format_addr('2001:db8::42'))
|
||||
with self.assertRaises(ValueError):
|
||||
test_utils.format_addr('999.999.999.999')
|
||||
with self.assertRaises(ValueError):
|
||||
test_utils.format_addr('2001:db8::g')
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
"""Module containing base class for implementing charm tests."""
|
||||
import contextlib
|
||||
import logging
|
||||
import ipaddress
|
||||
import subprocess
|
||||
import tenacity
|
||||
import unittest
|
||||
@@ -541,20 +540,3 @@ class OpenStackBaseTest(BaseCharmTest):
|
||||
instance_2 = self.retrieve_guest(
|
||||
'{}-ins-1'.format(self.RESOURCE_PREFIX))
|
||||
return instance_1, instance_2
|
||||
|
||||
|
||||
def format_addr(addr):
|
||||
"""Validate and format IP address.
|
||||
|
||||
:param addr: IPv6 or IPv4 address
|
||||
:type addr: str
|
||||
:returns: Address string, optionally encapsulated in brackets([])
|
||||
:rtype: str
|
||||
:raises: ValueError
|
||||
"""
|
||||
ipaddr = ipaddress.ip_address(addr)
|
||||
if isinstance(ipaddr, ipaddress.IPv6Address):
|
||||
fmt = '[{}]'
|
||||
else:
|
||||
fmt = '{}'
|
||||
return fmt.format(ipaddr)
|
||||
|
||||
@@ -27,7 +27,7 @@ import yaml
|
||||
import collections
|
||||
|
||||
import zaza.model
|
||||
import zaza.openstack.charm_tests.test_utils as test_utils
|
||||
import zaza.utilities.networking as network_utils
|
||||
|
||||
AUTH_FILE = "vault_tests.yaml"
|
||||
CharmVaultClient = collections.namedtuple(
|
||||
@@ -102,7 +102,7 @@ def get_unit_api_url(ip):
|
||||
transport = 'http'
|
||||
if vault_config['ssl-cert']['value']:
|
||||
transport = 'https'
|
||||
return '{}://{}:8200'.format(transport, test_utils.format_addr(ip))
|
||||
return '{}://{}:8200'.format(transport, network_utils.format_addr(ip))
|
||||
|
||||
|
||||
def get_hvac_client(vault_url, cacert=None):
|
||||
|
||||
@@ -68,6 +68,8 @@ from zaza.openstack.utilities import (
|
||||
exceptions,
|
||||
generic as generic_utils,
|
||||
)
|
||||
import zaza.utilities.networking as network_utils
|
||||
|
||||
|
||||
CIRROS_RELEASE_URL = 'http://download.cirros-cloud.net/version/released'
|
||||
CIRROS_IMAGE_URL = 'http://download.cirros-cloud.net'
|
||||
@@ -1704,6 +1706,7 @@ def get_overcloud_auth(address=None, model_name=None):
|
||||
|
||||
if not address:
|
||||
address = get_keystone_ip(model_name=model_name)
|
||||
address = network_utils.format_addr(address)
|
||||
|
||||
password = juju_utils.leader_get(
|
||||
'keystone',
|
||||
|
||||
Reference in New Issue
Block a user