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: Idab48a7831008c5353eeb56da5deb49ce1305a41
This commit is contained in:
Ryan Beisner 2016-09-22 17:59:19 +00:00
parent 94966e0e59
commit 2bd1f60d7c
10 changed files with 101 additions and 41 deletions

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, neutron, and nova

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

@ -26,8 +26,25 @@ from charmhelpers.contrib.openstack.amulet.utils import (
# ERROR
)
from novaclient import exceptions
class NovaOpenStackAmuletUtils(OpenStackAmuletUtils):
"""Nova based helper extending base helper for creation of flavors"""
def create_flavor(self, nova, name, ram, vcpus, disk, flavorid="auto",
ephemeral=0, swap=0, rxtx_factor=1.0, is_public=True):
"""Create the specified flavor."""
try:
nova.flavors.find(name=name)
except (exceptions.NotFound, exceptions.NoUniqueMatch):
self.log.debug('Creating flavor ({})'.format(name))
nova.flavors.create(name, ram, vcpus, disk, flavorid,
ephemeral, swap, rxtx_factor, is_public)
# Use DEBUG to turn on debug logging
u = OpenStackAmuletUtils(DEBUG)
u = NovaOpenStackAmuletUtils(DEBUG)
class NovaCCBasicDeployment(OpenStackAmuletDeployment):
@ -45,9 +62,10 @@ class NovaCCBasicDeployment(OpenStackAmuletDeployment):
self._deploy()
u.log.info('Waiting on extended status checks...')
exclude_services = ['mysql']
exclude_services = []
self._auto_wait_for_status(exclude_services=exclude_services)
self.d.sentry.wait()
self._initialize_tests()
def _assert_services(self, should_run):
@ -65,18 +83,20 @@ class NovaCCBasicDeployment(OpenStackAmuletDeployment):
compatible with the local charm (e.g. stable or next).
"""
this_service = {'name': 'nova-cloud-controller'}
other_services = [{'name': 'mysql'},
{'name': 'rabbitmq-server'},
{'name': 'nova-compute', 'units': 2},
{'name': 'keystone'},
{'name': 'glance'}]
other_services = [
{'name': 'rabbitmq-server'},
{'name': 'nova-compute', 'units': 2},
{'name': 'keystone'},
{'name': 'glance'},
{'name': 'percona-cluster', 'constraints': {'mem': '3072M'}},
]
super(NovaCCBasicDeployment, self)._add_services(this_service,
other_services)
def _add_relations(self):
"""Add all of the relations for the services."""
relations = {
'nova-cloud-controller:shared-db': 'mysql:shared-db',
'nova-cloud-controller:shared-db': 'percona-cluster:shared-db',
'nova-cloud-controller:identity-service': 'keystone:'
'identity-service',
'nova-cloud-controller:amqp': 'rabbitmq-server:amqp',
@ -84,11 +104,11 @@ class NovaCCBasicDeployment(OpenStackAmuletDeployment):
'cloud-compute',
'nova-cloud-controller:image-service': 'glance:image-service',
'nova-compute:image-service': 'glance:image-service',
'nova-compute:shared-db': 'mysql:shared-db',
'nova-compute:shared-db': 'percona-cluster:shared-db',
'nova-compute:amqp': 'rabbitmq-server:amqp',
'keystone:shared-db': 'mysql:shared-db',
'keystone:shared-db': 'percona-cluster:shared-db',
'glance:identity-service': 'keystone:identity-service',
'glance:shared-db': 'mysql:shared-db',
'glance:shared-db': 'percona-cluster:shared-db',
'glance:amqp': 'rabbitmq-server:amqp'
}
super(NovaCCBasicDeployment, self)._add_relations(relations)
@ -142,15 +162,26 @@ class NovaCCBasicDeployment(OpenStackAmuletDeployment):
keystone_config = {'admin-password': 'openstack',
'admin-token': 'ubuntutesting'}
configs = {'nova-cloud-controller': nova_cc_config,
'keystone': keystone_config, 'nova-compute': nova_config}
pxc_config = {
'dataset-size': '25%',
'max-connections': 1000,
'root-password': 'ChangeMe123',
'sst-password': 'ChangeMe123',
}
configs = {
'nova-cloud-controller': nova_cc_config,
'keystone': keystone_config,
'nova-compute': nova_config,
'percona-cluster': pxc_config,
}
super(NovaCCBasicDeployment, self)._configure_services(configs)
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.rabbitmq_sentry = self.d.sentry['rabbitmq-server'][0]
self.nova_cc_sentry = self.d.sentry['nova-cloud-controller'][0]
@ -171,6 +202,12 @@ class NovaCCBasicDeployment(OpenStackAmuletDeployment):
# Authenticate admin with glance endpoint
self.glance = u.authenticate_glance_admin(self.keystone)
# Authenticate admin with nova endpoint
self.nova = u.authenticate_nova_user(self.keystone,
user='admin',
password='openstack',
tenant='admin')
# Create a demo tenant/role/user
self.demo_tenant = 'demoTenant'
self.demo_role = 'demoRole'
@ -202,7 +239,6 @@ class NovaCCBasicDeployment(OpenStackAmuletDeployment):
service units."""
u.log.debug('Checking system services on units...')
services = {
self.mysql_sentry: ['mysql'],
self.rabbitmq_sentry: ['rabbitmq-server'],
self.nova_cc_sentry: ['nova-api-ec2',
'nova-api-os-compute',
@ -328,7 +364,7 @@ class NovaCCBasicDeployment(OpenStackAmuletDeployment):
"""Verify the nova-cc to mysql shared-db relation data"""
u.log.debug('Checking n-c-c:mysql db relation data...')
unit = self.nova_cc_sentry
relation = ['shared-db', 'mysql:shared-db']
relation = ['shared-db', 'percona-cluster:shared-db']
expected = {
'private-address': u.valid_ip,
@ -345,7 +381,7 @@ class NovaCCBasicDeployment(OpenStackAmuletDeployment):
def test_202_mysql_shared_db_relation(self):
"""Verify the mysql to nova-cc shared-db relation data"""
u.log.debug('Checking mysql:n-c-c db relation data...')
unit = self.mysql_sentry
unit = self.pxc_sentry
relation = ['shared-db', 'nova-cloud-controller:shared-db']
expected = {
'private-address': u.valid_ip,
@ -540,7 +576,7 @@ class NovaCCBasicDeployment(OpenStackAmuletDeployment):
ks_ncc_rel['service_host'],
ks_ncc_rel['auth_port'])
db_ncc_rel = self.mysql_sentry.relation(
db_ncc_rel = self.pxc_sentry.relation(
'shared-db', 'nova-cloud-controller:shared-db')
db_uri = "mysql://{}:{}@{}/{}".format('nova',
@ -708,6 +744,10 @@ class NovaCCBasicDeployment(OpenStackAmuletDeployment):
if not image:
amulet.raise_status(amulet.FAIL, msg="Image create failed")
# Ensure required flavor exists, required for >= newton
u.create_flavor(nova=self.nova,
name='m1.tiny', ram=512, vcpus=1, disk=1)
instance = u.create_instance(self.nova_demo, "cirros-image", "cirros",
"m1.tiny")
if not instance:

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

@ -15,12 +15,12 @@
# limitations under the License.
"""Amulet tests on a basic nova cloud controller deployment on
precise-icehouse."""
xenial-newton."""
from basic_deployment import NovaCCBasicDeployment
if __name__ == '__main__':
deployment = NovaCCBasicDeployment(series='precise',
openstack='cloud:precise-icehouse',
source='cloud:precise-updates/icehouse')
deployment = NovaCCBasicDeployment(series='xenial',
openstack='cloud:xenial-newton',
source='cloud:xenial-updates/newton')
deployment.run_tests()

View File

@ -0,0 +1,24 @@
#!/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 nova cloud controller deployment on
yakkety-newton."""
from basic_deployment import NovaCCBasicDeployment
if __name__ == '__main__':
deployment = NovaCCBasicDeployment(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