From c16f94fab08999a1c38ed8cbfb772c32211f93b1 Mon Sep 17 00:00:00 2001 From: Ryan Beisner Date: Thu, 22 Sep 2016 18:00:04 +0000 Subject: [PATCH] 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: I244826aae8a17a35f4ef9d4ee89961be2488b372 --- .../contrib/openstack/amulet/deployment.py | 2 +- .../contrib/openstack/amulet/utils.py | 11 ++--- charmhelpers/contrib/openstack/utils.py | 5 +- tests/basic_deployment.py | 49 +++++++++++++------ .../contrib/openstack/amulet/deployment.py | 2 +- .../contrib/openstack/amulet/utils.py | 11 ++--- ...cise-icehouse => gate-basic-xenial-newton} | 8 +-- tests/gate-basic-yakkety-newton | 23 +++++++++ tests/tests.yaml | 4 +- 9 files changed, 75 insertions(+), 40 deletions(-) rename tests/{gate-basic-precise-icehouse => gate-basic-xenial-newton} (70%) create mode 100644 tests/gate-basic-yakkety-newton diff --git a/charmhelpers/contrib/openstack/amulet/deployment.py b/charmhelpers/contrib/openstack/amulet/deployment.py index 6fe8cf8..9e0b07f 100644 --- a/charmhelpers/contrib/openstack/amulet/deployment.py +++ b/charmhelpers/contrib/openstack/amulet/deployment.py @@ -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( diff --git a/charmhelpers/contrib/openstack/amulet/utils.py b/charmhelpers/contrib/openstack/amulet/utils.py index 24b353e..e4546c8 100644 --- a/charmhelpers/contrib/openstack/amulet/utils.py +++ b/charmhelpers/contrib/openstack/amulet/utils.py @@ -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" diff --git a/charmhelpers/contrib/openstack/utils.py b/charmhelpers/contrib/openstack/utils.py index 9abd4c3..8c89c3a 100644 --- a/charmhelpers/contrib/openstack/utils.py +++ b/charmhelpers/contrib/openstack/utils.py @@ -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 diff --git a/tests/basic_deployment.py b/tests/basic_deployment.py index 464143c..5ae55dd 100644 --- a/tests/basic_deployment.py +++ b/tests/basic_deployment.py @@ -41,11 +41,12 @@ class SwiftStorageBasicDeployment(OpenStackAmuletDeployment): self._deploy() u.log.info('Waiting on extended status checks...') - exclude_services = ['mysql'] + exclude_services = [] # Wait for deployment ready msgs, except exclusions self._auto_wait_for_status(exclude_services=exclude_services) + self.d.sentry.wait() self._initialize_tests() def _add_services(self): @@ -56,44 +57,61 @@ class SwiftStorageBasicDeployment(OpenStackAmuletDeployment): compatible with the local charm (e.g. stable or next). """ this_service = {'name': 'swift-storage'} - other_services = [{'name': 'mysql'}, {'name': 'keystone'}, - {'name': 'glance'}, {'name': 'swift-proxy'}] + other_services = [ + {'name': 'percona-cluster', 'constraints': {'mem': '3072M'}}, + {'name': 'keystone'}, + {'name': 'glance'}, + {'name': 'swift-proxy'} + ] super(SwiftStorageBasicDeployment, 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', + 'keystone:shared-db': 'percona-cluster:shared-db', 'swift-proxy:identity-service': 'keystone:identity-service', 'swift-storage:swift-storage': 'swift-proxy:swift-storage', 'glance:identity-service': 'keystone:identity-service', - 'glance:shared-db': 'mysql:shared-db', + 'glance:shared-db': 'percona-cluster:shared-db', 'glance:object-store': 'swift-proxy:object-store' } super(SwiftStorageBasicDeployment, self)._add_relations(relations) def _configure_services(self): """Configure all of the services.""" - keystone_config = {'admin-password': 'openstack', - 'admin-token': 'ubuntutesting'} + keystone_config = { + 'admin-password': 'openstack', + 'admin-token': 'ubuntutesting', + } swift_proxy_config = { 'zone-assignment': 'manual', 'replicas': '1', - 'swift-hash': 'fdfef9d4-8b06-11e2-8ac0-531c923c8fae' + 'swift-hash': 'fdfef9d4-8b06-11e2-8ac0-531c923c8fae', + } + swift_storage_config = { + 'zone': '1', + 'block-device': 'vdb', + 'overwrite': 'true', + } + pxc_config = { + 'dataset-size': '25%', + 'max-connections': 1000, + 'root-password': 'ChangeMe123', + 'sst-password': 'ChangeMe123', + } + configs = { + 'keystone': keystone_config, + 'swift-proxy': swift_proxy_config, + 'swift-storage': swift_storage_config, + 'percona-cluster': pxc_config, } - swift_storage_config = {'zone': '1', - 'block-device': 'vdb', - 'overwrite': 'true'} - configs = {'keystone': keystone_config, - 'swift-proxy': swift_proxy_config, - 'swift-storage': swift_storage_config} super(SwiftStorageBasicDeployment, 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.glance_sentry = self.d.sentry['glance'][0] self.swift_proxy_sentry = self.d.sentry['swift-proxy'][0] @@ -164,7 +182,6 @@ class SwiftStorageBasicDeployment(OpenStackAmuletDeployment): if self._get_openstack_release() >= self.precise_icehouse: swift_storage_services.append('swift-container-sync') service_names = { - self.mysql_sentry: ['mysql'], self.keystone_sentry: ['keystone'], self.glance_sentry: ['glance-registry', 'glance-api'], diff --git a/tests/charmhelpers/contrib/openstack/amulet/deployment.py b/tests/charmhelpers/contrib/openstack/amulet/deployment.py index 6fe8cf8..9e0b07f 100644 --- a/tests/charmhelpers/contrib/openstack/amulet/deployment.py +++ b/tests/charmhelpers/contrib/openstack/amulet/deployment.py @@ -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( diff --git a/tests/charmhelpers/contrib/openstack/amulet/utils.py b/tests/charmhelpers/contrib/openstack/amulet/utils.py index 24b353e..e4546c8 100644 --- a/tests/charmhelpers/contrib/openstack/amulet/utils.py +++ b/tests/charmhelpers/contrib/openstack/amulet/utils.py @@ -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" diff --git a/tests/gate-basic-precise-icehouse b/tests/gate-basic-xenial-newton similarity index 70% rename from tests/gate-basic-precise-icehouse rename to tests/gate-basic-xenial-newton index 755d3a8..7270a29 100755 --- a/tests/gate-basic-precise-icehouse +++ b/tests/gate-basic-xenial-newton @@ -14,12 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Amulet tests on a basic swift-storage deployment on precise-icehouse.""" +"""Amulet tests on a basic swift-storage deployment on xenial-newton.""" from basic_deployment import SwiftStorageBasicDeployment if __name__ == '__main__': - deployment = SwiftStorageBasicDeployment(series='precise', - openstack='cloud:precise-icehouse', - source='cloud:precise-updates/icehouse') + deployment = SwiftStorageBasicDeployment(series='xenial', + openstack='cloud:xenial-newton', + source='cloud:xenial-updates/newton') deployment.run_tests() diff --git a/tests/gate-basic-yakkety-newton b/tests/gate-basic-yakkety-newton new file mode 100644 index 0000000..fc92472 --- /dev/null +++ b/tests/gate-basic-yakkety-newton @@ -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 swift-storage deployment on yakkety-newton.""" + +from basic_deployment import SwiftStorageBasicDeployment + +if __name__ == '__main__': + deployment = SwiftStorageBasicDeployment(series='yakkety') + deployment.run_tests() diff --git a/tests/tests.yaml b/tests/tests.yaml index e3185c6..e27d100 100644 --- a/tests/tests.yaml +++ b/tests/tests.yaml @@ -1,7 +1,7 @@ # Bootstrap the model if necessary. bootstrap: True -# Re-use bootstrap node instead of destroying/re-bootstrapping. -reset: True +# No reset https://bugs.launchpad.net/juju/+bug/1541482 +reset: False # Use tox/requirements to drive the venv instead of bundletester's venv feature. virtualenv: False # Leave makefile empty, otherwise unit/lint tests will rerun ahead of amulet.