Update amulet test definitions for Newton

- Remove Precise-Icehouse Amulet test definitions if they exist.

- Add Xenial-Newton Amulet test definitions.

- Add Yakkety-Newton Amulet test definitions.

- Use the percona-cluster charm in tests instead of the mysql charm.

Change-Id: Ia4c324b6fedec1dc607062a89eea7595d43c0060
This commit is contained in:
Ryan Beisner 2016-09-22 17:58:41 +00:00
parent 30d1bdb873
commit 6cd819aa3c
10 changed files with 74 additions and 43 deletions

View File

@ -156,7 +156,7 @@ class OpenStackAmuletDeployment(AmuletDeployment):
use_source = list(set(
use_source + ['mysql', 'mongodb', 'rabbitmq-server', 'ceph',
'ceph-osd', 'ceph-radosgw', 'ceph-mon',
'ceph-proxy']))
'ceph-proxy', 'percona-cluster', 'lxd']))
# Charms which can not use openstack-origin, ie. many subordinates
no_origin = list(set(

View File

@ -306,10 +306,8 @@ class OpenStackAmuletUtils(AmuletUtils):
password, tenant):
"""Authenticates admin user with cinder."""
# NOTE(beisner): cinder python client doesn't accept tokens.
service_ip = \
keystone_sentry.relation('shared-db',
'mysql:shared-db')['private-address']
ept = "http://{}:5000/v2.0".format(service_ip.strip().decode('utf-8'))
keystone_ip = keystone_sentry.info['public-address']
ept = "http://{}:5000/v2.0".format(keystone_ip.strip().decode('utf-8'))
return cinder_client.Client(username, password, tenant, ept)
def authenticate_keystone_admin(self, keystone_sentry, user, password,
@ -317,10 +315,9 @@ class OpenStackAmuletUtils(AmuletUtils):
keystone_ip=None):
"""Authenticates admin user with the keystone admin endpoint."""
self.log.debug('Authenticating keystone admin...')
unit = keystone_sentry
if not keystone_ip:
keystone_ip = unit.relation('shared-db',
'mysql:shared-db')['private-address']
keystone_ip = keystone_sentry.info['public-address']
base_ep = "http://{}:35357".format(keystone_ip.strip().decode('utf-8'))
if not api_version or api_version == 2:
ep = base_ep + "/v2.0"

View File

@ -229,6 +229,7 @@ GIT_DEFAULT_REPOS = {
GIT_DEFAULT_BRANCHES = {
'liberty': 'stable/liberty',
'mitaka': 'stable/mitaka',
'newton': 'stable/newton',
'master': 'master',
}
@ -735,12 +736,12 @@ def git_os_codename_install_source(projects_yaml):
if projects in GIT_DEFAULT_BRANCHES.keys():
if projects == 'master':
return 'newton'
return 'ocata'
return projects
if 'release' in projects:
if projects['release'] == 'master':
return 'newton'
return 'ocata'
return projects['release']
return None

View File

@ -48,6 +48,7 @@ options:
the corresponding OpenStack github branch will be used:
* liberty
* mitaka
* newton
* master
The YAML must minimally include requirements and keystone repositories,

View File

@ -54,9 +54,10 @@ class KeystoneBasicDeployment(OpenStackAmuletDeployment):
self._deploy()
u.log.info('Waiting on extended status checks...')
self.exclude_services = ['mysql']
self.exclude_services = []
self._auto_wait_for_status(exclude_services=self.exclude_services)
self.d.sentry.wait()
self._initialize_tests()
def _assert_services(self, should_run):
@ -75,25 +76,30 @@ class KeystoneBasicDeployment(OpenStackAmuletDeployment):
compatible with the local charm (e.g. stable or next).
"""
this_service = {'name': 'keystone'}
other_services = [{'name': 'mysql'},
{'name': 'rabbitmq-server'}, # satisfy wrkload stat
{'name': 'cinder'}]
other_services = [
{'name': 'percona-cluster', 'constraints': {'mem': '3072M'}},
{'name': 'rabbitmq-server'}, # satisfy wrkload stat
{'name': 'cinder'},
]
super(KeystoneBasicDeployment, self)._add_services(this_service,
other_services)
def _add_relations(self):
"""Add all of the relations for the services."""
relations = {'keystone:shared-db': 'mysql:shared-db',
'cinder:shared-db': 'mysql:shared-db',
relations = {'keystone:shared-db': 'percona-cluster:shared-db',
'cinder:shared-db': 'percona-cluster:shared-db',
'cinder:amqp': 'rabbitmq-server:amqp',
'cinder:identity-service': 'keystone:identity-service'}
super(KeystoneBasicDeployment, self)._add_relations(relations)
def _configure_services(self):
"""Configure all of the services."""
keystone_config = {'admin-password': 'openstack',
'admin-token': 'ubuntutesting',
'preferred-api-version': self.keystone_api_version}
keystone_config = {
'admin-password': 'openstack',
'admin-token': 'ubuntutesting',
'preferred-api-version': self.keystone_api_version,
}
if self.git:
amulet_http_proxy = os.environ.get('AMULET_HTTP_PROXY')
@ -121,12 +127,19 @@ class KeystoneBasicDeployment(OpenStackAmuletDeployment):
keystone_config['openstack-origin-git'] = \
yaml.dump(openstack_origin_git)
mysql_config = {'dataset-size': '50%'}
cinder_config = {'block-device': 'None'}
pxc_config = {
'dataset-size': '25%',
'max-connections': 1000,
'root-password': 'ChangeMe123',
'sst-password': 'ChangeMe123',
}
cinder_config = {
'block-device': 'None',
}
configs = {
'keystone': keystone_config,
'mysql': mysql_config,
'cinder': cinder_config
'percona-cluster': pxc_config,
'cinder': cinder_config,
}
super(KeystoneBasicDeployment, self)._configure_services(configs)
@ -230,7 +243,7 @@ class KeystoneBasicDeployment(OpenStackAmuletDeployment):
def _initialize_tests(self):
"""Perform final initialization before tests get run."""
# Access the sentries for inspecting service units
self.mysql_sentry = self.d.sentry['mysql'][0]
self.pxc_sentry = self.d.sentry['percona-cluster'][0]
self.keystone_sentry = self.d.sentry['keystone'][0]
self.cinder_sentry = self.d.sentry['cinder'][0]
u.log.debug('openstack release val: {}'.format(
@ -239,7 +252,7 @@ class KeystoneBasicDeployment(OpenStackAmuletDeployment):
self._get_openstack_release_string()))
self.keystone_ip = self.keystone_sentry.relation(
'shared-db',
'mysql:shared-db')['private-address']
'percona-cluster:shared-db')['private-address']
self.set_api_version(2)
# Authenticate keystone admin
self.keystone_v2 = self.get_keystone_client(api_version=2)
@ -250,7 +263,6 @@ class KeystoneBasicDeployment(OpenStackAmuletDeployment):
"""Verify the expected services are running on the corresponding
service units."""
services = {
self.mysql_sentry: ['mysql'],
self.keystone_sentry: ['keystone'],
self.cinder_sentry: ['cinder-api',
'cinder-scheduler',
@ -471,7 +483,7 @@ class KeystoneBasicDeployment(OpenStackAmuletDeployment):
"""Verify the keystone shared-db relation data"""
u.log.debug('Checking keystone to mysql db relation data...')
unit = self.keystone_sentry
relation = ['shared-db', 'mysql:shared-db']
relation = ['shared-db', 'percona-cluster:shared-db']
expected = {
'username': 'keystone',
'private-address': u.valid_ip,
@ -486,7 +498,7 @@ class KeystoneBasicDeployment(OpenStackAmuletDeployment):
def test_201_mysql_keystone_shared_db_relation(self):
"""Verify the mysql shared-db relation data"""
u.log.debug('Checking mysql to keystone db relation data...')
unit = self.mysql_sentry
unit = self.pxc_sentry
relation = ['shared-db', 'keystone:shared-db']
expected_data = {
'private-address': u.valid_ip,
@ -553,8 +565,8 @@ class KeystoneBasicDeployment(OpenStackAmuletDeployment):
conf = '/etc/keystone/keystone.conf'
ks_ci_rel = unit.relation('identity-service',
'cinder:identity-service')
my_ks_rel = self.mysql_sentry.relation('shared-db',
'keystone:shared-db')
my_ks_rel = self.pxc_sentry.relation('shared-db',
'keystone:shared-db')
db_uri = "mysql://{}:{}@{}/{}".format('keystone',
my_ks_rel['password'],
my_ks_rel['db_host'],

View File

@ -156,7 +156,7 @@ class OpenStackAmuletDeployment(AmuletDeployment):
use_source = list(set(
use_source + ['mysql', 'mongodb', 'rabbitmq-server', 'ceph',
'ceph-osd', 'ceph-radosgw', 'ceph-mon',
'ceph-proxy']))
'ceph-proxy', 'percona-cluster', 'lxd']))
# Charms which can not use openstack-origin, ie. many subordinates
no_origin = list(set(

View File

@ -306,10 +306,8 @@ class OpenStackAmuletUtils(AmuletUtils):
password, tenant):
"""Authenticates admin user with cinder."""
# NOTE(beisner): cinder python client doesn't accept tokens.
service_ip = \
keystone_sentry.relation('shared-db',
'mysql:shared-db')['private-address']
ept = "http://{}:5000/v2.0".format(service_ip.strip().decode('utf-8'))
keystone_ip = keystone_sentry.info['public-address']
ept = "http://{}:5000/v2.0".format(keystone_ip.strip().decode('utf-8'))
return cinder_client.Client(username, password, tenant, ept)
def authenticate_keystone_admin(self, keystone_sentry, user, password,
@ -317,10 +315,9 @@ class OpenStackAmuletUtils(AmuletUtils):
keystone_ip=None):
"""Authenticates admin user with the keystone admin endpoint."""
self.log.debug('Authenticating keystone admin...')
unit = keystone_sentry
if not keystone_ip:
keystone_ip = unit.relation('shared-db',
'mysql:shared-db')['private-address']
keystone_ip = keystone_sentry.info['public-address']
base_ep = "http://{}:35357".format(keystone_ip.strip().decode('utf-8'))
if not api_version or api_version == 2:
ep = base_ep + "/v2.0"

View File

@ -14,12 +14,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Amulet tests on a basic keystone deployment on precise-icehouse."""
"""Amulet tests on a basic keystone deployment on xenial-newton."""
from basic_deployment import KeystoneBasicDeployment
if __name__ == '__main__':
deployment = KeystoneBasicDeployment(series='precise',
openstack='cloud:precise-icehouse',
source='cloud:precise-updates/icehouse')
deployment = KeystoneBasicDeployment(series='xenial',
openstack='cloud:xenial-newton',
source='cloud:xenial-updates/newton')
deployment.run_tests()

View File

@ -0,0 +1,23 @@
#!/usr/bin/python
#
# Copyright 2016 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Amulet tests on a basic keystone deployment on yakkety-newton."""
from basic_deployment import KeystoneBasicDeployment
if __name__ == '__main__':
deployment = KeystoneBasicDeployment(series='yakkety')
deployment.run_tests()

View File

@ -1,6 +1,6 @@
# Bootstrap the model if necessary.
bootstrap: True
# Re-use bootstrap node instead of destroying/re-bootstrapping.
# Re-use bootstrap node.
reset: True
# Use tox/requirements to drive the venv instead of bundletester's venv feature.
virtualenv: False