Amulet test fixes:
* Makefile: Only run precise-icehouse and trusty-icehouse tests by default and increase test timeout * t/00-setup: Simplify dependencies install and add glanceclient * t/README: Mention charm-tools dependency * t/basic_deployment.py: - Specify unstable charm deployment - Use dicts in add_services - Let things settle with short sleep after deployment - Rename restart test - Cleanup on test failure - Fix mechanism_drivers expected value in test_ml2_config()
This commit is contained in:
parent
eb1cf44dd2
commit
31f23b8e2f
3
Makefile
3
Makefile
@ -23,7 +23,8 @@ test:
|
|||||||
# coreycb note: The -v should only be temporary until Amulet sends
|
# coreycb note: The -v should only be temporary until Amulet sends
|
||||||
# raise_status() messages to stderr:
|
# raise_status() messages to stderr:
|
||||||
# https://bugs.launchpad.net/amulet/+bug/1320357
|
# https://bugs.launchpad.net/amulet/+bug/1320357
|
||||||
@juju test -v -p AMULET_HTTP_PROXY
|
@juju test -v -p AMULET_HTTP_PROXY --timeout 900 \
|
||||||
|
00-setup 14-basic-precise-icehouse 15-basic-trusty-icehouse
|
||||||
|
|
||||||
publish: lint unit_test
|
publish: lint unit_test
|
||||||
bzr push lp:charms/quantum-gateway
|
bzr push lp:charms/quantum-gateway
|
||||||
|
@ -4,7 +4,8 @@ set -ex
|
|||||||
|
|
||||||
sudo add-apt-repository --yes ppa:juju/stable
|
sudo add-apt-repository --yes ppa:juju/stable
|
||||||
sudo apt-get update --yes
|
sudo apt-get update --yes
|
||||||
sudo apt-get install --yes python-amulet
|
sudo apt-get install --yes python-amulet \
|
||||||
sudo apt-get install --yes python-neutronclient
|
python-neutronclient \
|
||||||
sudo apt-get install --yes python-keystoneclient
|
python-keystoneclient \
|
||||||
sudo apt-get install --yes python-novaclient
|
python-novaclient \
|
||||||
|
python-glanceclient
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
This directory provides Amulet tests that focus on verification of
|
This directory provides Amulet tests that focus on verification of
|
||||||
quantum-gateway deployments.
|
quantum-gateway deployments.
|
||||||
|
|
||||||
|
In order to run tests, you'll need charm-tools installed (in addition to
|
||||||
|
juju, of course):
|
||||||
|
sudo add-apt-repository ppa:juju/stable
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install charm-tools
|
||||||
|
|
||||||
If you use a web proxy server to access the web, you'll need to set the
|
If you use a web proxy server to access the web, you'll need to set the
|
||||||
AMULET_HTTP_PROXY environment variable to the http URL of the proxy server.
|
AMULET_HTTP_PROXY environment variable to the http URL of the proxy server.
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
import amulet
|
import amulet
|
||||||
|
import time
|
||||||
try:
|
try:
|
||||||
from quantumclient.v2_0 import client as neutronclient
|
from quantumclient.v2_0 import client as neutronclient
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@ -23,10 +24,10 @@ u = OpenStackAmuletUtils(ERROR)
|
|||||||
class QuantumGatewayBasicDeployment(OpenStackAmuletDeployment):
|
class QuantumGatewayBasicDeployment(OpenStackAmuletDeployment):
|
||||||
"""Amulet tests on a basic quantum-gateway deployment."""
|
"""Amulet tests on a basic quantum-gateway deployment."""
|
||||||
|
|
||||||
def __init__(self, series, openstack=None, source=None):
|
def __init__(self, series, openstack=None, source=None, stable=False):
|
||||||
"""Deploy the entire test environment."""
|
"""Deploy the entire test environment."""
|
||||||
super(QuantumGatewayBasicDeployment, self).__init__(series, openstack,
|
super(QuantumGatewayBasicDeployment, self).__init__(series, openstack,
|
||||||
source)
|
source, stable)
|
||||||
self._add_services()
|
self._add_services()
|
||||||
self._add_relations()
|
self._add_relations()
|
||||||
self._configure_services()
|
self._configure_services()
|
||||||
@ -34,13 +35,16 @@ class QuantumGatewayBasicDeployment(OpenStackAmuletDeployment):
|
|||||||
self._initialize_tests()
|
self._initialize_tests()
|
||||||
|
|
||||||
def _add_services(self):
|
def _add_services(self):
|
||||||
"""Add the service that we're testing, including the number of units,
|
"""Add services
|
||||||
where quantum-gateway is local, and the other charms are from
|
|
||||||
the charm store."""
|
Add the services that we're testing, where quantum-gateway is local,
|
||||||
this_service = ('quantum-gateway', 1)
|
and the rest of the service are from lp branches that are
|
||||||
other_services = [('mysql', 1),
|
compatible with the local charm (e.g. stable or next).
|
||||||
('rabbitmq-server', 1), ('keystone', 1),
|
"""
|
||||||
('nova-cloud-controller', 1)]
|
this_service = {'name': 'quantum-gateway'}
|
||||||
|
other_services = [{'name': 'mysql'},
|
||||||
|
{'name': 'rabbitmq-server'}, {'name': 'keystone'},
|
||||||
|
{'name': 'nova-cloud-controller'}]
|
||||||
super(QuantumGatewayBasicDeployment, self)._add_services(this_service,
|
super(QuantumGatewayBasicDeployment, self)._add_services(this_service,
|
||||||
other_services)
|
other_services)
|
||||||
|
|
||||||
@ -77,6 +81,9 @@ class QuantumGatewayBasicDeployment(OpenStackAmuletDeployment):
|
|||||||
self.nova_cc_sentry = self.d.sentry.unit['nova-cloud-controller/0']
|
self.nova_cc_sentry = self.d.sentry.unit['nova-cloud-controller/0']
|
||||||
self.quantum_gateway_sentry = self.d.sentry.unit['quantum-gateway/0']
|
self.quantum_gateway_sentry = self.d.sentry.unit['quantum-gateway/0']
|
||||||
|
|
||||||
|
# Let things settle a bit before moving forward
|
||||||
|
time.sleep(30)
|
||||||
|
|
||||||
# Authenticate admin with keystone
|
# Authenticate admin with keystone
|
||||||
self.keystone = u.authenticate_keystone_admin(self.keystone_sentry,
|
self.keystone = u.authenticate_keystone_admin(self.keystone_sentry,
|
||||||
user='admin',
|
user='admin',
|
||||||
@ -238,9 +245,14 @@ class QuantumGatewayBasicDeployment(OpenStackAmuletDeployment):
|
|||||||
message = u.relation_error('nova-cc network-service', ret)
|
message = u.relation_error('nova-cc network-service', ret)
|
||||||
amulet.raise_status(amulet.FAIL, msg=message)
|
amulet.raise_status(amulet.FAIL, msg=message)
|
||||||
|
|
||||||
def test_restart_on_config_change(self):
|
def test_z_restart_on_config_change(self):
|
||||||
"""Verify that the specified services are restarted when the config
|
"""Verify that the specified services are restarted when the config
|
||||||
is changed."""
|
is changed.
|
||||||
|
|
||||||
|
Note(coreycb): The method name with the _z_ is a little odd
|
||||||
|
but it forces the test to run last. It just makes things
|
||||||
|
easier because restarting services requires re-authorization.
|
||||||
|
"""
|
||||||
if self._get_openstack_release() >= self.precise_havana:
|
if self._get_openstack_release() >= self.precise_havana:
|
||||||
conf = '/etc/neutron/neutron.conf'
|
conf = '/etc/neutron/neutron.conf'
|
||||||
services = ['neutron-dhcp-agent', 'neutron-openvswitch-agent',
|
services = ['neutron-dhcp-agent', 'neutron-openvswitch-agent',
|
||||||
@ -261,6 +273,7 @@ class QuantumGatewayBasicDeployment(OpenStackAmuletDeployment):
|
|||||||
for s in services:
|
for s in services:
|
||||||
if not u.service_restarted(self.quantum_gateway_sentry, s, conf,
|
if not u.service_restarted(self.quantum_gateway_sentry, s, conf,
|
||||||
pgrep_full=True, sleep_time=time):
|
pgrep_full=True, sleep_time=time):
|
||||||
|
self.d.configure('quantum-gateway', {'debug': 'False'})
|
||||||
msg = "service {} didn't restart after config change".format(s)
|
msg = "service {} didn't restart after config change".format(s)
|
||||||
amulet.raise_status(amulet.FAIL, msg=msg)
|
amulet.raise_status(amulet.FAIL, msg=msg)
|
||||||
time = 0
|
time = 0
|
||||||
@ -347,7 +360,7 @@ class QuantumGatewayBasicDeployment(OpenStackAmuletDeployment):
|
|||||||
'ml2': {
|
'ml2': {
|
||||||
'type_drivers': 'gre,vxlan',
|
'type_drivers': 'gre,vxlan',
|
||||||
'tenant_network_types': 'gre,vxlan',
|
'tenant_network_types': 'gre,vxlan',
|
||||||
'mechanism_drivers': 'openvswitch'
|
'mechanism_drivers': 'openvswitch,l2population'
|
||||||
},
|
},
|
||||||
'ml2_type_gre': {
|
'ml2_type_gre': {
|
||||||
'tunnel_id_ranges': '1:1000'
|
'tunnel_id_ranges': '1:1000'
|
||||||
@ -629,7 +642,7 @@ class QuantumGatewayBasicDeployment(OpenStackAmuletDeployment):
|
|||||||
'nova_metadata_port': '8775'
|
'nova_metadata_port': '8775'
|
||||||
}
|
}
|
||||||
if self._get_openstack_release() >= self.precise_icehouse:
|
if self._get_openstack_release() >= self.precise_icehouse:
|
||||||
expected['cache_url'] = 'memory://?default_ttl=5'
|
expected['cache_url'] = 'memory://?default_ttl=5'
|
||||||
|
|
||||||
ret = u.validate_config_data(unit, conf, 'DEFAULT', expected)
|
ret = u.validate_config_data(unit, conf, 'DEFAULT', expected)
|
||||||
if ret:
|
if ret:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user