Amulet test fixes:
* Makefile: Only run precise-icehouse and trusty-icehouse tests by default and increase test timeout * t/00-setup: Add more required dependencies * t/README: Mention charm-tools dependency * t/basic_deployment.py: - Specify unstable charm deployment - Use dicts in add_services - Rename restart test - Only set one config option for restart test - Cleanup on test failure
This commit is contained in:
parent
f63cfcc12d
commit
8820389952
3
Makefile
3
Makefile
@ -26,7 +26,8 @@ test:
|
||||
# /!\ Note: The -v should only be temporary until Amulet sends
|
||||
# raise_status() messages to stderr:
|
||||
# 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
|
||||
bzr push lp:charms/glance
|
||||
|
@ -4,7 +4,7 @@ set -ex
|
||||
|
||||
sudo add-apt-repository --yes ppa:juju/stable
|
||||
sudo apt-get update --yes
|
||||
sudo apt-get install --yes python-amulet
|
||||
sudo apt-get install --yes python-keystoneclient
|
||||
sudo apt-get install --yes python-glanceclient
|
||||
|
||||
sudo apt-get install --yes python-amulet \
|
||||
python-keystoneclient \
|
||||
python-glanceclient \
|
||||
python-novaclient
|
||||
|
@ -1,6 +1,12 @@
|
||||
This directory provides Amulet tests that focus on verification of Glance
|
||||
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
|
||||
AMULET_HTTP_PROXY environment variable to the http URL of the proxy server.
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import amulet
|
||||
import time
|
||||
|
||||
from charmhelpers.contrib.openstack.amulet.deployment import (
|
||||
OpenStackAmuletDeployment
|
||||
@ -24,9 +23,9 @@ class GlanceBasicDeployment(OpenStackAmuletDeployment):
|
||||
# * Add tests with different storage back ends
|
||||
# * Resolve Essex->Havana juju set charm bug
|
||||
|
||||
def __init__(self, series=None, openstack=None, source=None):
|
||||
def __init__(self, series=None, openstack=None, source=None, stable=False):
|
||||
'''Deploy the entire test environment.'''
|
||||
super(GlanceBasicDeployment, self).__init__(series, openstack, source)
|
||||
super(GlanceBasicDeployment, self).__init__(series, openstack, source, stable)
|
||||
self._add_services()
|
||||
self._add_relations()
|
||||
self._configure_services()
|
||||
@ -34,11 +33,15 @@ class GlanceBasicDeployment(OpenStackAmuletDeployment):
|
||||
self._initialize_tests()
|
||||
|
||||
def _add_services(self):
|
||||
'''Add the service that we're testing, including the number of units,
|
||||
where this charm is local, and the other charms are from
|
||||
the charm store.'''
|
||||
this_service = ('glance', 1)
|
||||
other_services = [('mysql', 1), ('rabbitmq-server', 1), ('keystone', 1)]
|
||||
'''Add services
|
||||
|
||||
Add the services that we're testing, where glance is local,
|
||||
and the rest of the service are from lp branches that are
|
||||
compatible with the local charm (e.g. stable or next).
|
||||
'''
|
||||
this_service = {'name': 'glance'}
|
||||
other_services = [{'name': 'mysql'}, {'name': 'rabbitmq-server'},
|
||||
{'name': 'keystone'}]
|
||||
super(GlanceBasicDeployment, self)._add_services(this_service,
|
||||
other_services)
|
||||
|
||||
@ -438,42 +441,51 @@ class GlanceBasicDeployment(OpenStackAmuletDeployment):
|
||||
amulet.raise_status(amulet.FAIL,
|
||||
msg='keystone endpoint: {}'.format(ret))
|
||||
|
||||
def test_glance_restart_on_config_change(self):
|
||||
'''Verify that glance is restarted when the config is changed.'''
|
||||
|
||||
# Make config change to trigger a service restart
|
||||
def _change_config(self):
|
||||
if self._get_openstack_release() > self.precise_havana:
|
||||
self.d.configure('glance', {'verbose': 'True'})
|
||||
self.d.configure('glance', {'debug': 'True'})
|
||||
elif self._get_openstack_release() <= self.precise_havana:
|
||||
else:
|
||||
self.d.configure('glance', {'debug': 'False'})
|
||||
|
||||
def _restore_config(self):
|
||||
if self._get_openstack_release() > self.precise_havana:
|
||||
self.d.configure('glance', {'debug': 'False'})
|
||||
else:
|
||||
self.d.configure('glance', {'debug': 'True'})
|
||||
|
||||
def test_z_glance_restart_on_config_change(self):
|
||||
'''Verify that glance is restarted when the config 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:
|
||||
# /!\ NOTE(beisner): Glance charm before Icehouse doesn't respond
|
||||
# to attempted config changes via juju / juju set.
|
||||
# https://bugs.launchpad.net/charms/+source/glance/+bug/1340307
|
||||
|
||||
u.log.error('NOTE(beisner): skipping glance restart on config ' +
|
||||
'change check due to bug 1340307.')
|
||||
return
|
||||
self.d.configure('glance', {'verbose': 'False'})
|
||||
self.d.configure('glance', {'debug': 'False'})
|
||||
|
||||
# Make config change to trigger a service restart
|
||||
self._change_config()
|
||||
|
||||
if not u.service_restarted(self.glance_sentry, 'glance-api',
|
||||
'/etc/glance/glance-api.conf'):
|
||||
self._restore_config()
|
||||
message = "glance service didn't restart after config change"
|
||||
amulet.raise_status(amulet.FAIL, msg=message)
|
||||
|
||||
if not u.service_restarted(self.glance_sentry, 'glance-registry',
|
||||
'/etc/glance/glance-registry.conf',
|
||||
sleep_time=0):
|
||||
self._restore_config()
|
||||
message = "glance service didn't restart after config change"
|
||||
amulet.raise_status(amulet.FAIL, msg=message)
|
||||
|
||||
# Return to original config
|
||||
if self._get_openstack_release() > self.precise_havana:
|
||||
self.d.configure('glance', {'verbose': 'False'})
|
||||
self.d.configure('glance', {'debug': 'False'})
|
||||
else:
|
||||
self.d.configure('glance', {'verbose': 'True'})
|
||||
self.d.configure('glance', {'debug': 'True'})
|
||||
self._restore_config()
|
||||
|
||||
def test_users(self):
|
||||
'''Verify expected users.'''
|
||||
|
Loading…
x
Reference in New Issue
Block a user