[coreycb,r=james-page] Fixup amulet test failures.

This commit is contained in:
James Page
2014-10-06 21:51:06 +01:00
5 changed files with 38 additions and 19 deletions

View File

@@ -14,7 +14,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

@@ -78,6 +78,8 @@ SWIFT_CODENAMES = OrderedDict([
('1.12.0', 'icehouse'), ('1.12.0', 'icehouse'),
('1.11.0', 'icehouse'), ('1.11.0', 'icehouse'),
('2.0.0', 'juno'), ('2.0.0', 'juno'),
('2.1.0', 'juno'),
('2.2.0', 'juno'),
]) ])
DEFAULT_LOOPBACK_SIZE = '5G' DEFAULT_LOOPBACK_SIZE = '5G'

View File

@@ -4,5 +4,7 @@ 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-keystoneclient python-keystoneclient \
python-glanceclient \
python-novaclient

View File

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

@@ -19,9 +19,9 @@ u = OpenStackAmuletUtils(ERROR)
class KeystoneBasicDeployment(OpenStackAmuletDeployment): class KeystoneBasicDeployment(OpenStackAmuletDeployment):
"""Amulet tests on a basic keystone deployment.""" """Amulet tests on a basic keystone deployment."""
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.""" """Deploy the entire test environment."""
super(KeystoneBasicDeployment, self).__init__(series, openstack, source) super(KeystoneBasicDeployment, self).__init__(series, openstack, source, stable)
self._add_services() self._add_services()
self._add_relations() self._add_relations()
self._configure_services() self._configure_services()
@@ -29,11 +29,14 @@ class KeystoneBasicDeployment(OpenStackAmuletDeployment):
self._initialize_tests() self._initialize_tests()
def _add_services(self): def _add_services(self):
"""Add the services that we're testing, including the number of units, """Add services
where keystone is local, and mysql and cinder are from the charm
store.""" Add the services that we're testing, where keystone is local,
this_service = ('keystone', 1) and the rest of the service are from lp branches that are
other_services = [('mysql', 1), ('cinder', 1)] compatible with the local charm (e.g. stable or next).
"""
this_service = {'name': 'keystone'}
other_services = [{'name': 'mysql'}, {'name': 'cinder'}]
super(KeystoneBasicDeployment, self)._add_services(this_service, super(KeystoneBasicDeployment, self)._add_services(this_service,
other_services) other_services)
@@ -61,7 +64,7 @@ class KeystoneBasicDeployment(OpenStackAmuletDeployment):
self.keystone_sentry = self.d.sentry.unit['keystone/0'] self.keystone_sentry = self.d.sentry.unit['keystone/0']
self.cinder_sentry = self.d.sentry.unit['cinder/0'] self.cinder_sentry = self.d.sentry.unit['cinder/0']
# Authenticate admin with keystone # Authenticate keystone admin
self.keystone = u.authenticate_keystone_admin(self.keystone_sentry, self.keystone = u.authenticate_keystone_admin(self.keystone_sentry,
user='admin', user='admin',
password='openstack', password='openstack',
@@ -80,7 +83,7 @@ class KeystoneBasicDeployment(OpenStackAmuletDeployment):
tenant_id=tenant.id, tenant_id=tenant.id,
email='demo@demo.com') email='demo@demo.com')
# Authenticate demo user with keystone # Authenticate keystone demo
self.keystone_demo = u.authenticate_keystone_user(self.keystone, self.keystone_demo = u.authenticate_keystone_user(self.keystone,
user=self.demo_user, user=self.demo_user,
password='password', password='password',
@@ -123,10 +126,8 @@ class KeystoneBasicDeployment(OpenStackAmuletDeployment):
def test_roles(self): def test_roles(self):
"""Verify all existing roles.""" """Verify all existing roles."""
role1 = {'name': 'demoRole', 'id': u.not_null} role1 = {'name': 'demoRole', 'id': u.not_null}
role2 = {'name': 'KeystoneAdmin', 'id': u.not_null} role2 = {'name': 'Admin', 'id': u.not_null}
role3 = {'name': 'KeystoneServiceAdmin', 'id': u.not_null} expected = [role1, role2]
role4 = {'name': 'Admin', 'id': u.not_null}
expected = [role1, role2, role3, role4]
actual = self.keystone.roles.list() actual = self.keystone.roles.list()
ret = u.validate_role_data(expected, actual) ret = u.validate_role_data(expected, actual)
@@ -280,11 +281,18 @@ class KeystoneBasicDeployment(OpenStackAmuletDeployment):
message = u.relation_error('cinder identity-service', ret) message = u.relation_error('cinder identity-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 keystone is restarted when the config is changed.""" """Verify that keystone 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.
"""
self.d.configure('keystone', {'verbose': 'True'}) self.d.configure('keystone', {'verbose': 'True'})
if not u.service_restarted(self.keystone_sentry, 'keystone-all', if not u.service_restarted(self.keystone_sentry, 'keystone-all',
'/etc/keystone/keystone.conf', sleep_time=10): '/etc/keystone/keystone.conf',
sleep_time=30):
self.d.configure('keystone', {'verbose': 'False'})
message = "keystone service didn't restart after config change" message = "keystone service didn't restart after config change"
amulet.raise_status(amulet.FAIL, msg=message) amulet.raise_status(amulet.FAIL, msg=message)
self.d.configure('keystone', {'verbose': 'False'}) self.d.configure('keystone', {'verbose': 'False'})