Amulet test fixes:

* Makefile: Only run precise-icehouse and trusty-icehouse tests by default
    and increase test timeout
  * t/00-setup: Simplify dependencies install
  * t/README: Mention charm-tools dependency
  * t/basic_deployment.py:
    - Specify unstable charm deployment
    - Use dicts in add_services
    - Rename restart test
    - Cleanup on test failure
This commit is contained in:
Corey Bryant 2014-09-29 21:14:05 +00:00
parent 88d327e31c
commit ee3913680b
4 changed files with 33 additions and 16 deletions

View File

@ -15,7 +15,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
bin/charm_helpers_sync.py: bin/charm_helpers_sync.py:
@mkdir -p bin @mkdir -p bin

View File

@ -4,8 +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-swiftclient python-swiftclient \
sudo apt-get install --yes python-glanceclient python-glanceclient \
sudo apt-get install --yes python-keystoneclient python-keystoneclient \
sudo apt-get install --yes python-novaclient python-novaclient

View File

@ -1,6 +1,12 @@
This directory provides Amulet tests that focus on verification of swift-storage This directory provides Amulet tests that focus on verification of swift-storage
deployments. 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.

View File

@ -20,10 +20,10 @@ u = OpenStackAmuletUtils(ERROR)
class SwiftStorageBasicDeployment(OpenStackAmuletDeployment): class SwiftStorageBasicDeployment(OpenStackAmuletDeployment):
"""Amulet tests on a basic swift-storage deployment.""" """Amulet tests on a basic swift-storage 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(SwiftStorageBasicDeployment, self).__init__(series, openstack, super(SwiftStorageBasicDeployment, 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()
@ -31,12 +31,15 @@ class SwiftStorageBasicDeployment(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 swift-storage is local, and the other charms are from
the charm store.""" Add the services that we're testing, where swift-storage is local,
this_service = ('swift-storage', 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).
('keystone', 1), ('glance', 1), ('swift-proxy', 1)] """
this_service = {'name': 'swift-storage'}
other_services = [{'name': 'mysql'}, {'name': 'keystone'},
{'name': 'glance'}, {'name': 'swift-proxy'}]
super(SwiftStorageBasicDeployment, self)._add_services(this_service, super(SwiftStorageBasicDeployment, self)._add_services(this_service,
other_services) other_services)
@ -249,9 +252,14 @@ class SwiftStorageBasicDeployment(OpenStackAmuletDeployment):
message = u.relation_error('swift-proxy swift-storage', ret) message = u.relation_error('swift-proxy swift-storage', 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.
"""
# NOTE(coreycb): Skipping failing test on until resolved. This test # NOTE(coreycb): Skipping failing test on until resolved. This test
# fails because the config file's last mod time is # fails because the config file's last mod time is
# slightly after the process' last mod time. # slightly after the process' last mod time.
@ -282,6 +290,8 @@ class SwiftStorageBasicDeployment(OpenStackAmuletDeployment):
config = '/etc/swift/{}'.format(conf) config = '/etc/swift/{}'.format(conf)
if not u.service_restarted(self.swift_storage_sentry, s, config, if not u.service_restarted(self.swift_storage_sentry, s, config,
pgrep_full=True, sleep_time=time): pgrep_full=True, sleep_time=time):
self.d.configure('swift-storage',
{'object-server-threads-per-disk': '4'})
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