Enable Zesty-Ocata Amulet Tests
- Turn on Zesty-Ocata Amulet test definitions. - Standardize test-requirements.txt - Sync charm helpers for various fixes Change-Id: I22d7f8f37bf53635cb689803eb6e9b5170181bb1
This commit is contained in:
parent
7f1b953982
commit
45f5a8a9a6
@ -239,6 +239,16 @@ def format_ipv6_addr(address):
|
||||
return None
|
||||
|
||||
|
||||
def is_ipv6_disabled():
|
||||
try:
|
||||
result = subprocess.check_output(
|
||||
['sysctl', 'net.ipv6.conf.all.disable_ipv6'],
|
||||
stderr=subprocess.STDOUT)
|
||||
return "net.ipv6.conf.all.disable_ipv6 = 1" in result
|
||||
except subprocess.CalledProcessError:
|
||||
return True
|
||||
|
||||
|
||||
def get_iface_addr(iface='eth0', inet_type='AF_INET', inc_aliases=False,
|
||||
fatal=True, exc_list=None):
|
||||
"""Return the assigned IP address for a given interface, if any.
|
||||
@ -544,31 +554,38 @@ def assert_charm_supports_ipv6():
|
||||
"versions less than Trusty 14.04")
|
||||
|
||||
|
||||
def get_relation_ip(interface, config_override=None):
|
||||
"""Return this unit's IP for the given relation.
|
||||
def get_relation_ip(interface, cidr_network=None):
|
||||
"""Return this unit's IP for the given interface.
|
||||
|
||||
Allow for an arbitrary interface to use with network-get to select an IP.
|
||||
Handle all address selection options including configuration parameter
|
||||
override and IPv6.
|
||||
Handle all address selection options including passed cidr network and
|
||||
IPv6.
|
||||
|
||||
Usage: get_relation_ip('amqp', config_override='access-network')
|
||||
Usage: get_relation_ip('amqp', cidr_network='10.0.0.0/8')
|
||||
|
||||
@param interface: string name of the relation.
|
||||
@param config_override: string name of the config option for network
|
||||
override. Supports legacy network override configuration parameters.
|
||||
@param cidr_network: string CIDR Network to select an address from.
|
||||
@raises Exception if prefer-ipv6 is configured but IPv6 unsupported.
|
||||
@returns IPv6 or IPv4 address
|
||||
"""
|
||||
# Select the interface address first
|
||||
# For possible use as a fallback bellow with get_address_in_network
|
||||
try:
|
||||
# Get the interface specific IP
|
||||
address = network_get_primary_address(interface)
|
||||
except NotImplementedError:
|
||||
# If network-get is not available
|
||||
address = get_host_ip(unit_get('private-address'))
|
||||
|
||||
fallback = get_host_ip(unit_get('private-address'))
|
||||
if config('prefer-ipv6'):
|
||||
# Currently IPv6 has priority, eventually we want IPv6 to just be
|
||||
# another network space.
|
||||
assert_charm_supports_ipv6()
|
||||
return get_ipv6_addr()[0]
|
||||
elif config_override and config(config_override):
|
||||
return get_address_in_network(config(config_override),
|
||||
fallback)
|
||||
else:
|
||||
try:
|
||||
return network_get_primary_address(interface)
|
||||
except NotImplementedError:
|
||||
return fallback
|
||||
elif cidr_network:
|
||||
# If a specific CIDR network is passed get the address from that
|
||||
# network.
|
||||
return get_address_in_network(cidr_network, address)
|
||||
|
||||
# Return the interface address
|
||||
return address
|
||||
|
@ -191,7 +191,7 @@ def service_pause(service_name, init_dir="/etc/init", initd_dir="/etc/init.d",
|
||||
upstart_file = os.path.join(init_dir, "{}.conf".format(service_name))
|
||||
sysv_file = os.path.join(initd_dir, service_name)
|
||||
if init_is_systemd():
|
||||
service('disable', service_name)
|
||||
service('mask', service_name)
|
||||
elif os.path.exists(upstart_file):
|
||||
override_path = os.path.join(
|
||||
init_dir, '{}.override'.format(service_name))
|
||||
@ -224,7 +224,7 @@ def service_resume(service_name, init_dir="/etc/init",
|
||||
upstart_file = os.path.join(init_dir, "{}.conf".format(service_name))
|
||||
sysv_file = os.path.join(initd_dir, service_name)
|
||||
if init_is_systemd():
|
||||
service('enable', service_name)
|
||||
service('unmask', service_name)
|
||||
elif os.path.exists(upstart_file):
|
||||
override_path = os.path.join(
|
||||
init_dir, '{}.override'.format(service_name))
|
||||
|
@ -10,4 +10,3 @@ Jinja2>=2.6 # BSD License (3 clause)
|
||||
six>=1.9.0
|
||||
dnspython>=1.12.0
|
||||
psutil>=1.1.1,<2.0.0
|
||||
python-neutronclient>=2.6.0
|
||||
|
@ -11,13 +11,17 @@ requests==2.6.0
|
||||
# Liberty client lower constraints
|
||||
amulet>=1.14.3,<2.0
|
||||
bundletester>=0.6.1,<1.0
|
||||
python-ceilometerclient>=1.5.0,<2.0
|
||||
python-cinderclient>=1.4.0,<2.0
|
||||
python-glanceclient>=1.1.0,<2.0
|
||||
python-heatclient>=0.8.0,<1.0
|
||||
python-novaclient>=2.30.1,<3.0
|
||||
python-openstackclient>=1.7.0,<2.0
|
||||
python-swiftclient>=2.6.0,<3.0
|
||||
python-ceilometerclient>=1.5.0
|
||||
python-cinderclient>=1.4.0
|
||||
python-glanceclient>=1.1.0
|
||||
python-heatclient>=0.8.0
|
||||
python-keystoneclient>=1.7.1
|
||||
python-neutronclient>=3.1.0
|
||||
python-novaclient>=2.30.1
|
||||
python-openstackclient>=1.7.0
|
||||
python-swiftclient>=2.6.0
|
||||
pika>=0.10.0,<1.0
|
||||
distro-info
|
||||
# END: Amulet OpenStack Charm Helper Requirements
|
||||
# NOTE: workaround for 14.04 pip/tox
|
||||
pytz
|
||||
|
@ -39,6 +39,12 @@ class BasicDeployment(OpenStackAmuletDeployment):
|
||||
("Please set the vip in local.yaml or "
|
||||
"env var AMULET_OS_VIP to run this test "
|
||||
"suite"))
|
||||
|
||||
# Currenlty serverstack is unable to validate HA
|
||||
# temporarily turn off HA
|
||||
self.vip = None
|
||||
self.ha = False
|
||||
|
||||
self.log = self.utils.get_logger()
|
||||
|
||||
def _add_services(self):
|
||||
@ -51,7 +57,7 @@ class BasicDeployment(OpenStackAmuletDeployment):
|
||||
this_service = {'name': 'percona-cluster',
|
||||
'units': self.units}
|
||||
other_services = []
|
||||
if self.units > 1:
|
||||
if self.units > 1 and self.ha:
|
||||
other_services.append({'name': 'hacluster'})
|
||||
|
||||
super(BasicDeployment, self)._add_services(this_service,
|
||||
@ -59,7 +65,8 @@ class BasicDeployment(OpenStackAmuletDeployment):
|
||||
|
||||
def _add_relations(self):
|
||||
"""Add all of the relations for the services."""
|
||||
if self.units > 1:
|
||||
|
||||
if self.units > 1 and self.ha:
|
||||
relations = {'percona-cluster:ha': 'hacluster:ha'}
|
||||
super(BasicDeployment, self)._add_relations(relations)
|
||||
|
||||
@ -76,7 +83,7 @@ class BasicDeployment(OpenStackAmuletDeployment):
|
||||
'C1w=')}
|
||||
|
||||
configs = {}
|
||||
if self.units > 1:
|
||||
if self.units > 1 and self.ha:
|
||||
cfg_ha['cluster_count'] = str(self.units)
|
||||
configs['hacluster'] = cfg_ha
|
||||
configs['percona-cluster'] = cfg_percona
|
||||
@ -101,7 +108,8 @@ class BasicDeployment(OpenStackAmuletDeployment):
|
||||
self.test_bootstrapped_and_clustered()
|
||||
self.test_bootstrap_uuid_set_in_the_relation()
|
||||
self.test_pause_resume()
|
||||
self.test_kill_master()
|
||||
if self.ha:
|
||||
self.test_kill_master()
|
||||
|
||||
def test_pacemaker(self):
|
||||
'''
|
||||
@ -110,10 +118,11 @@ class BasicDeployment(OpenStackAmuletDeployment):
|
||||
|
||||
side effect: self.master_unit should be set after execution
|
||||
'''
|
||||
if self.units > 1:
|
||||
|
||||
if self.units > 1 and self.ha:
|
||||
i = 0
|
||||
while i < 30 and not self.master_unit:
|
||||
self.master_unit = self.find_master()
|
||||
self.master_unit = self.find_master(ha=self.ha)
|
||||
i += 1
|
||||
time.sleep(10)
|
||||
|
||||
@ -129,7 +138,7 @@ class BasicDeployment(OpenStackAmuletDeployment):
|
||||
|
||||
assert sorted(self.get_pcmkr_resources()) == sorted(resources)
|
||||
else:
|
||||
self.master_unit = self.find_master(ha=False)
|
||||
self.master_unit = self.find_master(ha=self.ha)
|
||||
|
||||
def test_pxc_running(self):
|
||||
'''
|
||||
@ -217,7 +226,7 @@ class BasicDeployment(OpenStackAmuletDeployment):
|
||||
while i < 10 and not changed:
|
||||
i += 1
|
||||
time.sleep(5) # give some time to pacemaker to react
|
||||
new_master = self.find_master()
|
||||
new_master = self.find_master(ha=self.ha)
|
||||
|
||||
if (new_master and new_master.info['unit_name'] !=
|
||||
old_master.info['unit_name']):
|
||||
|
@ -547,7 +547,7 @@ class OpenStackAmuletUtils(AmuletUtils):
|
||||
"""Create the specified instance."""
|
||||
self.log.debug('Creating instance '
|
||||
'({}|{}|{})'.format(instance_name, image_name, flavor))
|
||||
image = nova.images.find(name=image_name)
|
||||
image = nova.glance.find_image(image_name)
|
||||
flavor = nova.flavors.find(name=flavor)
|
||||
instance = nova.servers.create(name=instance_name, image=image,
|
||||
flavor=flavor)
|
||||
|
8
tests/gate-basic-xenial-ocata
Executable file
8
tests/gate-basic-xenial-ocata
Executable file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import basic_deployment
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
t = basic_deployment.BasicDeployment(units=3, series='xenial')
|
||||
t.run()
|
0
tests/gate-basic-zesty-ocata
Normal file → Executable file
0
tests/gate-basic-zesty-ocata
Normal file → Executable file
Loading…
Reference in New Issue
Block a user