diff --git a/Makefile b/Makefile index 7912970..105f867 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,8 @@ test: # coreycb 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 bin/charm_helpers_sync.py: @mkdir -p bin diff --git a/tests/00-setup b/tests/00-setup index f40cdd7..b78050f 100755 --- a/tests/00-setup +++ b/tests/00-setup @@ -4,8 +4,8 @@ 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-swiftclient -sudo apt-get install --yes python-glanceclient -sudo apt-get install --yes python-keystoneclient -sudo apt-get install --yes python-novaclient +sudo apt-get install --yes python-amulet \ + python-swiftclient \ + python-glanceclient \ + python-keystoneclient \ + python-novaclient diff --git a/tests/README b/tests/README index 3a9b785..cb2c743 100644 --- a/tests/README +++ b/tests/README @@ -1,6 +1,12 @@ This directory provides Amulet tests that focus on verification of swift-proxy 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. diff --git a/tests/basic_deployment.py b/tests/basic_deployment.py index 292475b..da965a7 100644 --- a/tests/basic_deployment.py +++ b/tests/basic_deployment.py @@ -20,10 +20,10 @@ u = OpenStackAmuletUtils(ERROR) class SwiftProxyBasicDeployment(OpenStackAmuletDeployment): """Amulet tests on a basic swift-proxy deployment.""" - def __init__(self, series, openstack=None, source=None): + def __init__(self, series, openstack=None, source=None, stable=False): """Deploy the entire test environment.""" super(SwiftProxyBasicDeployment, self).__init__(series, openstack, - source) + source, stable) self._add_services() self._add_relations() self._configure_services() @@ -31,12 +31,15 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment): self._initialize_tests() def _add_services(self): - """Add the service that we're testing, including the number of units, - where swift-proxy is local, and the other charms are from - the charm store.""" - this_service = ('swift-proxy', 1) - other_services = [('mysql', 1), - ('keystone', 1), ('glance', 1), ('swift-storage', 1)] + """Add services + + Add the services that we're testing, where swift-proxy 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': 'swift-proxy'} + other_services = [{'name': 'mysql'}, {'name': 'keystone'}, + {'name': 'glance'}, {'name': 'swift-storage'}] super(SwiftProxyBasicDeployment, self)._add_services(this_service, other_services) @@ -315,14 +318,20 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment): message = u.relation_error('swift-proxy object-store', ret) 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 - 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. + """ svc = 'swift-proxy' self.d.configure('swift-proxy', {'node-timeout': '90'}) if not u.service_restarted(self.swift_proxy_sentry, svc, '/etc/swift/proxy-server.conf'): + self.d.configure('swift-proxy', {'node-timeout': '60'}) msg = "service {} didn't restart after config change".format(svc) amulet.raise_status(amulet.FAIL, msg=msg)