From 8490919e2fdf529e1a5d1d7a54b6fbf1d4507c67 Mon Sep 17 00:00:00 2001 From: Sahid Orentino Ferdjaoui Date: Fri, 23 Nov 2018 17:14:11 +0100 Subject: [PATCH] Migrate functional tests from amulet to zaza Change-Id: I339748e528ac57879ae2210f8f1e196fd04093dc Func-Test-PR: https://github.com/openstack-charmers/zaza-openstack-tests/pull/229 Closes-Bug: 1828424 --- Makefile | 6 +- test-requirements.txt | 41 +- tests/README.md | 7 +- tests/basic_deployment.py | 671 ------------------------------- tests/bundles/bionic-queens.yaml | 86 ++++ tests/bundles/bionic-rocky.yaml | 94 +++++ tests/bundles/bionic-stein.yaml | 94 +++++ tests/bundles/bionic-train.yaml | 105 +++++ tests/bundles/trusty-mitaka.yaml | 92 +++++ tests/bundles/xenial-mitaka.yaml | 86 ++++ tests/bundles/xenial-ocata.yaml | 94 +++++ tests/bundles/xenial-pike.yaml | 94 +++++ tests/bundles/xenial-queens.yaml | 94 +++++ tests/gate-basic-bionic-queens | 23 -- tests/gate-basic-bionic-rocky | 25 -- tests/gate-basic-bionic-stein | 25 -- tests/gate-basic-bionic-train | 25 -- tests/gate-basic-trusty-mitaka | 25 -- tests/gate-basic-xenial-mitaka | 23 -- tests/gate-basic-xenial-ocata | 25 -- tests/gate-basic-xenial-pike | 25 -- tests/gate-basic-xenial-queens | 25 -- tests/tests.yaml | 44 +- tox.ini | 56 ++- 24 files changed, 912 insertions(+), 973 deletions(-) delete mode 100644 tests/basic_deployment.py create mode 100644 tests/bundles/bionic-queens.yaml create mode 100644 tests/bundles/bionic-rocky.yaml create mode 100644 tests/bundles/bionic-stein.yaml create mode 100644 tests/bundles/bionic-train.yaml create mode 100644 tests/bundles/trusty-mitaka.yaml create mode 100644 tests/bundles/xenial-mitaka.yaml create mode 100644 tests/bundles/xenial-ocata.yaml create mode 100644 tests/bundles/xenial-pike.yaml create mode 100644 tests/bundles/xenial-queens.yaml delete mode 100755 tests/gate-basic-bionic-queens delete mode 100755 tests/gate-basic-bionic-rocky delete mode 100755 tests/gate-basic-bionic-stein delete mode 100755 tests/gate-basic-bionic-train delete mode 100755 tests/gate-basic-trusty-mitaka delete mode 100755 tests/gate-basic-xenial-mitaka delete mode 100755 tests/gate-basic-xenial-ocata delete mode 100755 tests/gate-basic-xenial-pike delete mode 100755 tests/gate-basic-xenial-queens diff --git a/Makefile b/Makefile index 8a79e0c7..e6e1d00e 100644 --- a/Makefile +++ b/Makefile @@ -6,11 +6,11 @@ lint: test: @echo Starting unit tests... - @tox -e py27 + @tox -e py37 functional_test: - @echo Starting Amulet tests... - @tox -e func27 + @echo Starting Zaza functional tests... + @tox -e func bin/charm_helpers_sync.py: @mkdir -p bin diff --git a/test-requirements.txt b/test-requirements.txt index bb2e3a72..7d9c2587 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,29 +1,18 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. +# This file is managed centrally by release-tools and should not be modified +# within individual charm repos. See the 'global' dir contents for available +# choices of *requirements.txt files for OpenStack Charms: +# https://github.com/openstack-charmers/release-tools +# +# TODO: Distill the func test requirements from the lint/unit test +# requirements. They are intertwined. Also, Zaza itself should specify +# all of its own requirements and if it doesn't, fix it there. +# charm-tools>=2.4.4 -coverage>=3.6 +requests>=2.18.4 mock>=1.2 flake8>=2.2.4,<=2.4.1 -stestr -requests>=2.18.4 -# BEGIN: Amulet OpenStack Charm Helper Requirements -# Liberty client lower constraints -amulet>=1.14.3,<2.0;python_version=='2.7' -bundletester>=0.6.1,<1.0;python_version=='2.7' -python-ceilometerclient>=1.5.0 -python-cinderclient>=1.4.0,<5.0.0 -python-glanceclient>=1.1.0 -python-heatclient>=0.8.0 -python-keystoneclient>=1.7.1 -python-neutronclient>=3.1.0 -python-novaclient>=2.30.1 -python-openstackclient>=1.7.0 -python-swiftclient>=2.6.0 -pika>=0.10.0,<1.0 -distro-info -git+https://github.com/juju/charm-helpers.git#egg=charmhelpers -# END: Amulet OpenStack Charm Helper Requirements -# NOTE: workaround for 14.04 pip/tox -pytz -pyudev # for ceph-* charm unit tests (not mocked?) +stestr>=2.2.0 +coverage>=4.5.2 +pyudev # for ceph-* charm unit tests (need to fix the ceph-* charm unit tests/mocking) +git+https://github.com/openstack-charmers/zaza.git#egg=zaza;python_version>='3.0' +git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack diff --git a/tests/README.md b/tests/README.md index 046be7fb..cc183e88 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,8 +1,9 @@ # Overview -This directory provides Amulet tests to verify basic deployment functionality -from the perspective of this charm, its requirements and its features, as -exercised in a subset of the full OpenStack deployment test bundle topology. +This directory provides Zaza test definitions and bundles to verify basic +deployment functionality from the perspective of this charm, its requirements +and its features, as exercised in a subset of the full OpenStack deployment +test bundle topology. For full details on functional testing of OpenStack charms please refer to the [functional testing](http://docs.openstack.org/developer/charm-guide/testing.html#functional-testing) diff --git a/tests/basic_deployment.py b/tests/basic_deployment.py deleted file mode 100644 index 01feecb1..00000000 --- a/tests/basic_deployment.py +++ /dev/null @@ -1,671 +0,0 @@ -# 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. - -import amulet - -from charmhelpers.contrib.openstack.amulet.deployment import ( - OpenStackAmuletDeployment -) - -from charmhelpers.contrib.openstack.amulet.utils import ( - OpenStackAmuletUtils, - DEBUG, - # ERROR -) -from charmhelpers.contrib.openstack.utils import CompareOpenStackReleases - -import keystoneclient -from keystoneclient.v3 import client as keystone_client_v3 -from novaclient import client as nova_client -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 = NovaOpenStackAmuletUtils(DEBUG) - - -class NovaBasicDeployment(OpenStackAmuletDeployment): - """Amulet tests on a basic nova compute deployment.""" - - def __init__(self, series=None, openstack=None, source=None, - stable=False): - """Deploy the entire test environment.""" - super(NovaBasicDeployment, self).__init__(series, openstack, - source, stable) - self._add_services() - self._add_relations() - self._configure_services() - self._deploy() - - u.log.info('Waiting on extended status checks...') - self.exclude_services = [] - self._auto_wait_for_status(exclude_services=self.exclude_services) - - self.d.sentry.wait() - self._initialize_tests() - - def _add_services(self): - """Add services - - Add the services that we're testing, where nova-compute 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': 'nova-compute'} - other_services = [ - {'name': 'rabbitmq-server'}, - {'name': 'nova-cloud-controller'}, - {'name': 'keystone'}, - {'name': 'glance'}, - {'name': 'percona-cluster'}, - ] - if self._get_openstack_release() >= self.trusty_mitaka: - other_mitaka_services = [ - {'name': 'neutron-gateway'}, - {'name': 'neutron-api'}, - {'name': 'neutron-openvswitch'}, - ] - other_services += other_mitaka_services - if self._get_openstack_release() >= self.bionic_train: - other_train_services = [ - {'name': 'placement'}, - ] - other_services += other_train_services - - super(NovaBasicDeployment, self)._add_services(this_service, - other_services) - - def _add_relations(self): - """Add all of the relations for the services.""" - relations = { - 'nova-compute:image-service': 'glance:image-service', - 'nova-compute:amqp': 'rabbitmq-server:amqp', - 'nova-cloud-controller:shared-db': 'percona-cluster:shared-db', - 'nova-cloud-controller:identity-service': 'keystone:' - 'identity-service', - 'nova-cloud-controller:amqp': 'rabbitmq-server:amqp', - 'nova-cloud-controller:cloud-compute': 'nova-compute:' - 'cloud-compute', - 'nova-cloud-controller:image-service': 'glance:image-service', - 'keystone:shared-db': 'percona-cluster:shared-db', - 'glance:identity-service': 'keystone:identity-service', - 'glance:shared-db': 'percona-cluster:shared-db', - 'glance:amqp': 'rabbitmq-server:amqp' - } - if self._get_openstack_release() >= self.trusty_mitaka: - mitaka_relations = { - 'neutron-gateway:amqp': 'rabbitmq-server:amqp', - 'nova-cloud-controller:quantum-network-service': - 'neutron-gateway:quantum-network-service', - 'neutron-api:shared-db': 'percona-cluster:shared-db', - 'neutron-api:amqp': 'rabbitmq-server:amqp', - 'neutron-api:neutron-api': 'nova-cloud-controller:neutron-api', - 'neutron-api:identity-service': 'keystone:identity-service', - 'nova-compute:neutron-plugin': 'neutron-openvswitch:' - 'neutron-plugin', - 'rabbitmq-server:amqp': 'neutron-openvswitch:amqp', - } - relations.update(mitaka_relations) - if self._get_openstack_release() >= self.bionic_train: - train_relations = { - 'placement:shared-db': 'percona-cluster:shared-db', - 'placement:identity-service': 'keystone:identity-service', - 'placement:placement': 'nova-cloud-controller:placement', - } - relations.update(train_relations) - - super(NovaBasicDeployment, self)._add_relations(relations) - - def _configure_services(self): - """Configure all of the services.""" - u.log.debug("Running all tests in Apparmor enforce mode.") - nova_config = {'config-flags': 'auto_assign_floating_ip=False', - 'enable-live-migration': 'False', - 'aa-profile-mode': 'enforce'} - if self._get_openstack_release() > self.trusty_mitaka: - nova_config.update({'ephemeral-device': '/dev/vdb', - 'ephemeral-unmount': '/mnt'}) - nova_cc_config = {} - if self._get_openstack_release() >= self.trusty_mitaka: - nova_cc_config['network-manager'] = 'Neutron' - - keystone_config = { - 'admin-password': 'openstack', - 'admin-token': 'ubuntutesting', - } - pxc_config = { - 'max-connections': 1000, - } - placement_config = {} - - configs = { - 'nova-compute': nova_config, - 'keystone': keystone_config, - 'nova-cloud-controller': nova_cc_config, - 'percona-cluster': pxc_config, - } - if self._get_openstack_release() >= self.bionic_train: - configs['placement'] = placement_config - super(NovaBasicDeployment, self)._configure_services(configs) - - def _initialize_tests(self): - """Perform final initialization before tests get run.""" - # Access the sentries for inspecting service units - 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_compute_sentry = self.d.sentry['nova-compute'][0] - self.nova_cc_sentry = self.d.sentry['nova-cloud-controller'][0] - self.glance_sentry = self.d.sentry['glance'][0] - - u.log.debug('openstack release val: {}'.format( - self._get_openstack_release())) - u.log.debug('openstack release str: {}'.format( - self._get_openstack_release_string())) - - # Authenticate admin with keystone - self.keystone_session, self.keystone = u.get_default_keystone_session( - self.keystone_sentry, - openstack_release=self._get_openstack_release()) - - force_v1_client = False - if self._get_openstack_release() == self.trusty_icehouse: - # Updating image properties (such as arch or hypervisor) using the - # v2 api in icehouse results in: - # https://bugs.launchpad.net/python-glanceclient/+bug/1371559 - u.log.debug('Forcing glance to use v1 api') - force_v1_client = True - - # Authenticate admin with glance endpoint - self.glance = u.authenticate_glance_admin( - self.keystone, - force_v1_client=force_v1_client) - - # Authenticate admin with nova endpoint - self.nova = nova_client.Client(2, session=self.keystone_session) - - keystone_ip = self.keystone_sentry.info['public-address'] - - # Create a demo tenant/role/user - self.demo_tenant = 'demoTenant' - self.demo_role = 'demoRole' - self.demo_user = 'demoUser' - self.demo_project = 'demoProject' - self.demo_domain = 'demoDomain' - if self._get_openstack_release() >= self.xenial_queens: - self.create_users_v3() - self.demo_user_session, auth = u.get_keystone_session( - keystone_ip, - self.demo_user, - 'password', - api_version=3, - user_domain_name=self.demo_domain, - project_domain_name=self.demo_domain, - project_name=self.demo_project - ) - self.keystone_demo = keystone_client_v3.Client( - session=self.demo_user_session) - self.nova_demo = nova_client.Client( - 2, - session=self.demo_user_session) - else: - self.create_users_v2() - # Authenticate demo user with keystone - self.keystone_demo = \ - u.authenticate_keystone_user( - self.keystone, user=self.demo_user, - password='password', - tenant=self.demo_tenant) - # Authenticate demo user with nova-api - self.nova_demo = u.authenticate_nova_user(self.keystone, - user=self.demo_user, - password='password', - tenant=self.demo_tenant) - - def create_users_v3(self): - try: - self.keystone.projects.find(name=self.demo_project) - except keystoneclient.exceptions.NotFound: - domain = self.keystone.domains.create( - self.demo_domain, - description='Demo Domain', - enabled=True - ) - project = self.keystone.projects.create( - self.demo_project, - domain, - description='Demo Project', - enabled=True, - ) - user = self.keystone.users.create( - self.demo_user, - domain=domain.id, - project=self.demo_project, - password='password', - email='demov3@demo.com', - description='Demo', - enabled=True) - role = self.keystone.roles.find(name='Admin') - self.keystone.roles.grant( - role.id, - user=user.id, - project=project.id) - - def create_users_v2(self): - if not u.tenant_exists(self.keystone, self.demo_tenant): - tenant = self.keystone.tenants.create(tenant_name=self.demo_tenant, - description='demo tenant', - enabled=True) - - self.keystone.roles.create(name=self.demo_role) - self.keystone.users.create(name=self.demo_user, - password='password', - tenant_id=tenant.id, - email='demo@demo.com') - - def test_100_services(self): - """Verify the expected services are running on the corresponding - service units.""" - u.log.debug('Checking system services on units...') - - services = { - self.rabbitmq_sentry: ['rabbitmq-server'], - self.nova_compute_sentry: ['nova-compute', - 'nova-network', - 'nova-api'], - self.nova_cc_sentry: ['nova-conductor'], - self.keystone_sentry: ['keystone'], - self.glance_sentry: ['glance-api'] - } - - if self._get_openstack_release() >= self.trusty_liberty: - services[self.keystone_sentry] = ['apache2'] - - _os_release = self._get_openstack_release_string() - if CompareOpenStackReleases(_os_release) >= 'mitaka': - services[self.nova_compute_sentry].remove('nova-network') - services[self.nova_compute_sentry].remove('nova-api') - - ret = u.validate_services_by_name(services) - if ret: - amulet.raise_status(amulet.FAIL, msg=ret) - - def test_102_service_catalog(self): - """Verify that the service catalog endpoint data is valid.""" - u.log.debug('Checking keystone service catalog...') - - endpoint_vol = {'adminURL': u.valid_url, - 'region': 'RegionOne', - 'id': u.not_null, - 'publicURL': u.valid_url, - 'internalURL': u.valid_url} - endpoint_id = {'adminURL': u.valid_url, - 'region': 'RegionOne', - 'id': u.not_null, - 'publicURL': u.valid_url, - 'internalURL': u.valid_url} - - if self._get_openstack_release() >= self.trusty_kilo: - expected = {'compute': [endpoint_vol], 'identity': [endpoint_id]} - else: - expected = {'s3': [endpoint_vol], 'compute': [endpoint_vol], - 'ec2': [endpoint_vol], 'identity': [endpoint_id]} - actual = self.keystone.service_catalog.get_endpoints() - - ret = u.validate_svc_catalog_endpoint_data( - expected, - actual, - openstack_release=self._get_openstack_release()) - if ret: - amulet.raise_status(amulet.FAIL, msg=ret) - - def test_104_openstack_compute_api_endpoint(self): - """Verify the openstack compute api (osapi) endpoint data.""" - u.log.debug('Checking compute endpoint data...') - - endpoints = self.keystone.endpoints.list() - admin_port = internal_port = public_port = '8774' - expected = { - 'id': u.not_null, - 'region': 'RegionOne', - 'adminurl': u.valid_url, - 'internalurl': u.valid_url, - 'publicurl': u.valid_url, - 'service_id': u.not_null - } - - ret = u.validate_endpoint_data( - endpoints, - admin_port, - internal_port, - public_port, - expected, - openstack_release=self._get_openstack_release()) - - if ret: - message = 'osapi endpoint: {}'.format(ret) - amulet.raise_status(amulet.FAIL, msg=message) - - def test_106_ec2_api_endpoint(self): - """Verify the EC2 api endpoint data.""" - if self._get_openstack_release() >= self.trusty_kilo: - return - - u.log.debug('Checking ec2 endpoint data...') - endpoints = self.keystone.endpoints.list() - admin_port = internal_port = public_port = '8773' - expected = { - 'id': u.not_null, - 'region': 'RegionOne', - 'adminurl': u.valid_url, - 'internalurl': u.valid_url, - 'publicurl': u.valid_url, - 'service_id': u.not_null - } - - ret = u.validate_endpoint_data(endpoints, admin_port, internal_port, - public_port, expected) - if ret: - message = 'EC2 endpoint: {}'.format(ret) - amulet.raise_status(amulet.FAIL, msg=message) - - def test_108_s3_api_endpoint(self): - """Verify the S3 api endpoint data.""" - if self._get_openstack_release() >= self.trusty_kilo: - return - - u.log.debug('Checking s3 endpoint data...') - endpoints = self.keystone.endpoints.list() - admin_port = internal_port = public_port = '3333' - expected = { - 'id': u.not_null, - 'region': 'RegionOne', - 'adminurl': u.valid_url, - 'internalurl': u.valid_url, - 'publicurl': u.valid_url, - 'service_id': u.not_null - } - - ret = u.validate_endpoint_data(endpoints, admin_port, internal_port, - public_port, expected) - if ret: - message = 'S3 endpoint: {}'.format(ret) - amulet.raise_status(amulet.FAIL, msg=message) - - def test_204_nova_amqp_relation(self): - """Verify the nova-compute to rabbitmq-server amqp relation data""" - u.log.debug('Checking n-c:rmq amqp relation data...') - unit = self.nova_compute_sentry - relation = ['amqp', 'rabbitmq-server:amqp'] - expected = { - 'username': 'nova', - 'private-address': u.valid_ip, - 'vhost': 'openstack' - } - - ret = u.validate_relation_data(unit, relation, expected) - if ret: - message = u.relation_error('nova-compute amqp', ret) - amulet.raise_status(amulet.FAIL, msg=message) - - def test_206_rabbitmq_amqp_relation(self): - """Verify the rabbitmq-server to nova-compute amqp relation data""" - u.log.debug('Checking rmq:n-c amqp relation data...') - unit = self.rabbitmq_sentry - relation = ['amqp', 'nova-compute:amqp'] - expected = { - 'private-address': u.valid_ip, - 'password': u.not_null, - 'hostname': u.valid_ip - } - - ret = u.validate_relation_data(unit, relation, expected) - if ret: - message = u.relation_error('rabbitmq amqp', ret) - amulet.raise_status(amulet.FAIL, msg=message) - - def test_208_nova_cloud_compute_relation(self): - """Verify the nova-compute to nova-cc cloud-compute relation data""" - u.log.debug('Checking n-c:n-c-c cloud-compute relation data...') - unit = self.nova_compute_sentry - relation = ['cloud-compute', 'nova-cloud-controller:cloud-compute'] - expected = { - 'private-address': u.valid_ip, - } - - ret = u.validate_relation_data(unit, relation, expected) - if ret: - message = u.relation_error('nova-compute cloud-compute', ret) - amulet.raise_status(amulet.FAIL, msg=message) - - def test_210_nova_cc_cloud_compute_relation(self): - """Verify the nova-cc to nova-compute cloud-compute relation data""" - u.log.debug('Checking n-c-c:n-c cloud-compute relation data...') - unit = self.nova_cc_sentry - relation = ['cloud-compute', 'nova-compute:cloud-compute'] - expected = { - 'volume_service': 'cinder', - 'network_manager': 'flatdhcpmanager', - 'ec2_host': u.valid_ip, - 'private-address': u.valid_ip, - 'restart_trigger': u.not_null - } - - if self._get_openstack_release() >= self.trusty_mitaka: - expected['network_manager'] = 'neutron' - - ret = u.validate_relation_data(unit, relation, expected) - if ret: - message = u.relation_error('nova-cc cloud-compute', ret) - amulet.raise_status(amulet.FAIL, msg=message) - - def test_400_image_instance_create(self): - """Create an image/instance, verify they exist, and delete them.""" - - u.log.debug('Checking nova instance creation...') - - image = u.create_cirros_image(self.glance, "cirros-image") - if not image: - amulet.raise_status(amulet.FAIL, msg="Image create failed") - - # NOTE(jamespage): ensure require 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: - amulet.raise_status(amulet.FAIL, msg="Instance create failed") - - found = False - for instance in self.nova_demo.servers.list(): - if instance.name == 'cirros': - found = True - if instance.status != 'ACTIVE': - msg = "cirros instance is not active" - amulet.raise_status(amulet.FAIL, msg=msg) - - if not found: - message = "nova cirros instance does not exist" - amulet.raise_status(amulet.FAIL, msg=message) - - u.delete_resource(self.glance.images, image.id, - msg="glance image") - - u.delete_resource(self.nova_demo.servers, instance.id, - msg="nova instance") - - def test_500_hugepagereport_action(self): - """Verify hugepagereport""" - u.log.debug("Testing hugepagereport") - sentry_unit = self.nova_compute_sentry - - action_id = u.run_action(sentry_unit, "hugepagereport") - assert u.wait_on_action(action_id), "Hugepagereport action failed." - data = amulet.actions.get_action_output(action_id, full_output=True) - assert data.get(u"status") == "completed", ("Hugepagereport action" - "failed") - report = data.get(u"results").get(u"hugepagestats") - assert report.find('free_hugepages') != -1 - - def test_501_security_checklist_action(self): - """Verify expected result on a default install""" - u.log.debug("Testing security-checklist") - sentry_unit = self.nova_compute_sentry - - action_id = u.run_action(sentry_unit, "security-checklist") - u.wait_on_action(action_id) - data = amulet.actions.get_action_output(action_id, full_output=True) - assert data.get(u"status") == "failed", \ - "Security check is expected to not pass by default" - - def test_900_restart_on_config_change(self): - """Verify that the specified services are restarted when the config - is changed.""" - - sentry = self.nova_compute_sentry - juju_service = 'nova-compute' - - # Expected default and alternate values - set_default = {'verbose': 'False'} - set_alternate = {'verbose': 'True'} - - # Services which are expected to restart upon config change, - # and corresponding config files affected by the change - conf_file = '/etc/nova/nova.conf' - services = {'nova-compute': conf_file} - - if self._get_openstack_release() < self.trusty_mitaka: - services.update({ - 'nova-api': conf_file, - 'nova-network': conf_file - }) - - # Make config change, check for service restarts - u.log.debug('Making config change on {}...'.format(juju_service)) - mtime = u.get_sentry_time(sentry) - self.d.configure(juju_service, set_alternate) - self._auto_wait_for_status(exclude_services=self.exclude_services) - - sleep_time = 30 - for s, conf_file in services.iteritems(): - u.log.debug("Checking that service restarted: {}".format(s)) - if not u.validate_service_config_changed(sentry, mtime, s, - conf_file, - sleep_time=sleep_time): - - self.d.configure(juju_service, set_default) - msg = "service {} didn't restart after config change".format(s) - amulet.raise_status(amulet.FAIL, msg=msg) - sleep_time = 0 - - self.d.configure(juju_service, set_default) - - def test_910_pause_and_resume(self): - """The services can be paused and resumed. """ - u.log.debug('Checking pause and resume actions...') - sentry_unit = self.nova_compute_sentry - - assert u.status_get(sentry_unit)[0] == "active" - - action_id = u.run_action(sentry_unit, "pause") - assert u.wait_on_action(action_id), "Pause action failed." - assert u.status_get(sentry_unit)[0] == "maintenance" - - # check that on resume libvirt wasn't stopped (LP: #1802917) - cmd = ('cd hooks; python3 -c ' - '"from nova_compute_utils import libvirt_daemon; ' - 'print(libvirt_daemon())"') - daemon, code = sentry_unit.run(cmd) - - if self.series == "trusty": - cmd = 'service %s status' % daemon - else: - cmd = 'systemctl status %s' % daemon - - output, code = sentry_unit.run(cmd) - assert code == 0, '%s, exit code: %d, output: %s' % (cmd, code, output) - - action_id = u.run_action(sentry_unit, "resume") - assert u.wait_on_action(action_id), "Resume action failed." - assert u.status_get(sentry_unit)[0] == "active" - u.log.debug('OK') - - def test_920_change_aa_profile(self): - """Test changing the Apparmor profile mode""" - - # Services which are expected to restart upon config change, - # and corresponding config files affected by the change - - services = { - 'nova-compute': '/etc/apparmor.d/usr.bin.nova-compute', - } - - if self._get_openstack_release() < self.trusty_mitaka: - services.update({ - 'nova-network': '/etc/apparmor.d/usr.bin.nova-network', - 'nova-api': '/etc/apparmor.d/usr.bin.nova-api', - }) - - sentry = self.nova_compute_sentry - juju_service = 'nova-compute' - mtime = u.get_sentry_time(sentry) - set_default = {'aa-profile-mode': 'enforce'} - set_alternate = {'aa-profile-mode': 'complain'} - sleep_time = 60 - - # Change to complain mode - self.d.configure(juju_service, set_alternate) - self._auto_wait_for_status(exclude_services=self.exclude_services) - - for s, conf_file in services.iteritems(): - u.log.debug("Checking that service restarted: {}".format(s)) - if not u.validate_service_config_changed(sentry, mtime, s, - conf_file, - sleep_time=sleep_time): - - self.d.configure(juju_service, set_default) - msg = "service {} didn't restart after config change".format(s) - amulet.raise_status(amulet.FAIL, msg=msg) - sleep_time = 0 - - output, code = sentry.run('aa-status ' - '--complaining') - u.log.info("Assert output of aa-status --complaining >= 3. Result: {} " - "Exit Code: {}".format(output, code)) - assert int(output) >= len(services) - - def test_930_check_virsh_default_network(self): - """Verify that the default network created by libvirt was removed - by the charm. - """ - sentry = self.nova_compute_sentry - output, code = sentry.run('virsh net-dumpxml default') - u.log.info('Assert exit code of virsh net-dumpxml default != 0.' - 'Result: {} Exit Code: {}'.format(output, code)) - assert code != 0 diff --git a/tests/bundles/bionic-queens.yaml b/tests/bundles/bionic-queens.yaml new file mode 100644 index 00000000..2af013a7 --- /dev/null +++ b/tests/bundles/bionic-queens.yaml @@ -0,0 +1,86 @@ +series: bionic +relations: +- - nova-compute:image-service + - glance:image-service +- - nova-compute:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:shared-db + - percona-cluster:shared-db +- - nova-cloud-controller:identity-service + - keystone:identity-service +- - nova-cloud-controller:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:cloud-compute + - nova-compute:cloud-compute +- - nova-cloud-controller:image-service + - glance:image-service +- - keystone:shared-db + - percona-cluster:shared-db +- - glance:identity-service + - keystone:identity-service +- - glance:shared-db + - percona-cluster:shared-db +- - glance:amqp + - rabbitmq-server:amqp +- - neutron-gateway:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:quantum-network-service + - neutron-gateway:quantum-network-service +- - neutron-api:shared-db + - percona-cluster:shared-db +- - neutron-api:amqp + - rabbitmq-server:amqp +- - neutron-api:neutron-api + - nova-cloud-controller:neutron-api +- - neutron-api:identity-service + - keystone:identity-service +- - nova-compute:neutron-plugin + - neutron-openvswitch:neutron-plugin +- - rabbitmq-server:amqp + - neutron-openvswitch:amqp +applications: + rabbitmq-server: + charm: cs:~openstack-charmers-next/rabbitmq-server + num_units: 1 + percona-cluster: + charm: cs:~openstack-charmers-next/percona-cluster + num_units: 1 + options: + max-connections: 1000 + innodb-buffer-pool-size: 256M + nova-cloud-controller: + charm: cs:~openstack-charmers-next/nova-cloud-controller + num_units: 1 + options: + network-manager: Neutron + debug: true + neutron-api: + charm: cs:~openstack-charmers-next/neutron-api + num_units: 1 + options: + flat-network-providers: physnet1 + neutron-security-groups: true + keystone: + charm: cs:~openstack-charmers-next/keystone + num_units: 1 + neutron-gateway: + charm: cs:~openstack-charmers-next/neutron-gateway + num_units: 1 + options: + bridge-mappings: physnet1:br-ex + glance: + charm: cs:~openstack-charmers-next/glance + num_units: 1 + neutron-openvswitch: + charm: cs:~openstack-charmers-next/neutron-openvswitch + nova-compute: + charm: ../../../nova-compute + num_units: 1 + constraints: mem=4G cores=4 + options: + config-flags: auto_assign_floating_ip=False + enable-live-migration: false + aa-profile-mode: enforce + ephemeral-device: /dev/vdb + ephemeral-unmount: /mnt + debug: true diff --git a/tests/bundles/bionic-rocky.yaml b/tests/bundles/bionic-rocky.yaml new file mode 100644 index 00000000..cc1c5775 --- /dev/null +++ b/tests/bundles/bionic-rocky.yaml @@ -0,0 +1,94 @@ +series: bionic +relations: +- - nova-compute:image-service + - glance:image-service +- - nova-compute:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:shared-db + - percona-cluster:shared-db +- - nova-cloud-controller:identity-service + - keystone:identity-service +- - nova-cloud-controller:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:cloud-compute + - nova-compute:cloud-compute +- - nova-cloud-controller:image-service + - glance:image-service +- - keystone:shared-db + - percona-cluster:shared-db +- - glance:identity-service + - keystone:identity-service +- - glance:shared-db + - percona-cluster:shared-db +- - glance:amqp + - rabbitmq-server:amqp +- - neutron-gateway:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:quantum-network-service + - neutron-gateway:quantum-network-service +- - neutron-api:shared-db + - percona-cluster:shared-db +- - neutron-api:amqp + - rabbitmq-server:amqp +- - neutron-api:neutron-api + - nova-cloud-controller:neutron-api +- - neutron-api:identity-service + - keystone:identity-service +- - nova-compute:neutron-plugin + - neutron-openvswitch:neutron-plugin +- - rabbitmq-server:amqp + - neutron-openvswitch:amqp +applications: + rabbitmq-server: + charm: cs:~openstack-charmers-next/rabbitmq-server + num_units: 1 + percona-cluster: + charm: cs:~openstack-charmers-next/percona-cluster + num_units: 1 + options: + max-connections: 1000 + innodb-buffer-pool-size: 256M + nova-cloud-controller: + charm: cs:~openstack-charmers-next/nova-cloud-controller + num_units: 1 + options: + openstack-origin: cloud:bionic-rocky + network-manager: Neutron + debug: true + neutron-api: + charm: cs:~openstack-charmers-next/neutron-api + num_units: 1 + options: + openstack-origin: cloud:bionic-rocky + flat-network-providers: physnet1 + neutron-security-groups: true + keystone: + charm: cs:~openstack-charmers-next/keystone + num_units: 1 + options: + openstack-origin: cloud:bionic-rocky + neutron-gateway: + charm: cs:~openstack-charmers-next/neutron-gateway + num_units: 1 + options: + openstack-origin: cloud:bionic-rocky + bridge-mappings: physnet1:br-ex + glance: + charm: cs:~openstack-charmers-next/glance + num_units: 1 + options: + openstack-origin: cloud:bionic-rocky + neutron-openvswitch: + charm: cs:~openstack-charmers-next/neutron-openvswitch + nova-compute: + charm: ../../../nova-compute + num_units: 1 + constraints: mem=4G cores=4 + options: + openstack-origin: cloud:bionic-rocky + config-flags: auto_assign_floating_ip=False + enable-live-migration: false + aa-profile-mode: enforce + ephemeral-device: /dev/vdb + ephemeral-unmount: /mnt + debug: true diff --git a/tests/bundles/bionic-stein.yaml b/tests/bundles/bionic-stein.yaml new file mode 100644 index 00000000..6291db2d --- /dev/null +++ b/tests/bundles/bionic-stein.yaml @@ -0,0 +1,94 @@ +series: bionic +relations: +- - nova-compute:image-service + - glance:image-service +- - nova-compute:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:shared-db + - percona-cluster:shared-db +- - nova-cloud-controller:identity-service + - keystone:identity-service +- - nova-cloud-controller:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:cloud-compute + - nova-compute:cloud-compute +- - nova-cloud-controller:image-service + - glance:image-service +- - keystone:shared-db + - percona-cluster:shared-db +- - glance:identity-service + - keystone:identity-service +- - glance:shared-db + - percona-cluster:shared-db +- - glance:amqp + - rabbitmq-server:amqp +- - neutron-gateway:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:quantum-network-service + - neutron-gateway:quantum-network-service +- - neutron-api:shared-db + - percona-cluster:shared-db +- - neutron-api:amqp + - rabbitmq-server:amqp +- - neutron-api:neutron-api + - nova-cloud-controller:neutron-api +- - neutron-api:identity-service + - keystone:identity-service +- - nova-compute:neutron-plugin + - neutron-openvswitch:neutron-plugin +- - rabbitmq-server:amqp + - neutron-openvswitch:amqp +applications: + rabbitmq-server: + charm: cs:~openstack-charmers-next/rabbitmq-server + num_units: 1 + percona-cluster: + charm: cs:~openstack-charmers-next/percona-cluster + num_units: 1 + options: + max-connections: 1000 + innodb-buffer-pool-size: 256M + nova-cloud-controller: + charm: cs:~openstack-charmers-next/nova-cloud-controller + num_units: 1 + options: + openstack-origin: cloud:bionic-stein + network-manager: Neutron + debug: true + neutron-api: + charm: cs:~openstack-charmers-next/neutron-api + num_units: 1 + options: + openstack-origin: cloud:bionic-stein + flat-network-providers: physnet1 + neutron-security-groups: true + keystone: + charm: cs:~openstack-charmers-next/keystone + num_units: 1 + options: + openstack-origin: cloud:bionic-stein + neutron-gateway: + charm: cs:~openstack-charmers-next/neutron-gateway + num_units: 1 + options: + openstack-origin: cloud:bionic-stein + bridge-mappings: physnet1:br-ex + glance: + charm: cs:~openstack-charmers-next/glance + num_units: 1 + options: + openstack-origin: cloud:bionic-stein + neutron-openvswitch: + charm: cs:~openstack-charmers-next/neutron-openvswitch + nova-compute: + charm: ../../../nova-compute + num_units: 1 + constraints: mem=4G cores=4 + options: + openstack-origin: cloud:bionic-stein + config-flags: auto_assign_floating_ip=False + enable-live-migration: false + aa-profile-mode: enforce + ephemeral-device: /dev/vdb + ephemeral-unmount: /mnt + debug: true diff --git a/tests/bundles/bionic-train.yaml b/tests/bundles/bionic-train.yaml new file mode 100644 index 00000000..6d60dc88 --- /dev/null +++ b/tests/bundles/bionic-train.yaml @@ -0,0 +1,105 @@ +series: bionic +relations: +- - nova-compute:image-service + - glance:image-service +- - nova-compute:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:shared-db + - percona-cluster:shared-db +- - nova-cloud-controller:identity-service + - keystone:identity-service +- - nova-cloud-controller:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:cloud-compute + - nova-compute:cloud-compute +- - nova-cloud-controller:image-service + - glance:image-service +- - keystone:shared-db + - percona-cluster:shared-db +- - glance:identity-service + - keystone:identity-service +- - glance:shared-db + - percona-cluster:shared-db +- - glance:amqp + - rabbitmq-server:amqp +- - neutron-gateway:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:quantum-network-service + - neutron-gateway:quantum-network-service +- - neutron-api:shared-db + - percona-cluster:shared-db +- - neutron-api:amqp + - rabbitmq-server:amqp +- - neutron-api:neutron-api + - nova-cloud-controller:neutron-api +- - neutron-api:identity-service + - keystone:identity-service +- - nova-compute:neutron-plugin + - neutron-openvswitch:neutron-plugin +- - rabbitmq-server:amqp + - neutron-openvswitch:amqp +- - placement:shared-db + - percona-cluster:shared-db +- - placement:identity-service + - keystone:identity-service +- - placement:placement + - nova-cloud-controller:placement +applications: + rabbitmq-server: + charm: cs:~openstack-charmers-next/rabbitmq-server + num_units: 1 + percona-cluster: + charm: cs:~openstack-charmers-next/percona-cluster + num_units: 1 + options: + max-connections: 1000 + innodb-buffer-pool-size: 256M + nova-cloud-controller: + charm: cs:~openstack-charmers-next/nova-cloud-controller + num_units: 1 + options: + openstack-origin: cloud:bionic-train + network-manager: Neutron + debug: true + neutron-api: + charm: cs:~openstack-charmers-next/neutron-api + num_units: 1 + options: + openstack-origin: cloud:bionic-train + flat-network-providers: physnet1 + neutron-security-groups: true + keystone: + charm: cs:~openstack-charmers-next/keystone + num_units: 1 + options: + openstack-origin: cloud:bionic-train + neutron-gateway: + charm: cs:~openstack-charmers-next/neutron-gateway + num_units: 1 + options: + openstack-origin: cloud:bionic-train + bridge-mappings: physnet1:br-ex + glance: + charm: cs:~openstack-charmers-next/glance + num_units: 1 + options: + openstack-origin: cloud:bionic-train + neutron-openvswitch: + charm: cs:~openstack-charmers-next/neutron-openvswitch + placement: + charm: cs:~openstack-charmers-next/placement + num_units: 1 + options: + openstack-origin: cloud:bionic-train + nova-compute: + charm: ../../../nova-compute + num_units: 1 + constraints: mem=4G cores=4 + options: + openstack-origin: cloud:bionic-train + config-flags: auto_assign_floating_ip=False + enable-live-migration: false + aa-profile-mode: enforce + ephemeral-device: /dev/vdb + ephemeral-unmount: /mnt + debug: true diff --git a/tests/bundles/trusty-mitaka.yaml b/tests/bundles/trusty-mitaka.yaml new file mode 100644 index 00000000..e3775d1f --- /dev/null +++ b/tests/bundles/trusty-mitaka.yaml @@ -0,0 +1,92 @@ +series: trusty +relations: +- - nova-compute:image-service + - glance:image-service +- - nova-compute:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:shared-db + - percona-cluster:shared-db +- - nova-cloud-controller:identity-service + - keystone:identity-service +- - nova-cloud-controller:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:cloud-compute + - nova-compute:cloud-compute +- - nova-cloud-controller:image-service + - glance:image-service +- - keystone:shared-db + - percona-cluster:shared-db +- - glance:identity-service + - keystone:identity-service +- - glance:shared-db + - percona-cluster:shared-db +- - glance:amqp + - rabbitmq-server:amqp +- - neutron-gateway:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:quantum-network-service + - neutron-gateway:quantum-network-service +- - neutron-api:shared-db + - percona-cluster:shared-db +- - neutron-api:amqp + - rabbitmq-server:amqp +- - neutron-api:neutron-api + - nova-cloud-controller:neutron-api +- - neutron-api:identity-service + - keystone:identity-service +- - nova-compute:neutron-plugin + - neutron-openvswitch:neutron-plugin +- - rabbitmq-server:amqp + - neutron-openvswitch:amqp +applications: + rabbitmq-server: + charm: cs:~openstack-charmers-next/rabbitmq-server + num_units: 1 + percona-cluster: + charm: cs:trusty/percona-cluster + num_units: 1 + options: + max-connections: 1000 + innodb-buffer-pool-size: 256M + nova-cloud-controller: + charm: cs:~openstack-charmers-next/nova-cloud-controller + num_units: 1 + options: + openstack-origin: cloud:trusty-mitaka + debug: true + network-manager: Neutron + neutron-api: + charm: cs:~openstack-charmers-next/neutron-api + num_units: 1 + options: + openstack-origin: cloud:trusty-mitaka + flat-network-providers: physnet1 + neutron-security-groups: true + keystone: + charm: cs:~openstack-charmers-next/keystone + num_units: 1 + options: + openstack-origin: cloud:trusty-mitaka + neutron-gateway: + charm: cs:~openstack-charmers-next/neutron-gateway + num_units: 1 + options: + openstack-origin: cloud:trusty-mitaka + bridge-mappings: physnet1:br-ex + glance: + charm: cs:~openstack-charmers-next/glance + num_units: 1 + options: + openstack-origin: cloud:trusty-mitaka + neutron-openvswitch: + charm: cs:~openstack-charmers-next/neutron-openvswitch + nova-compute: + charm: ../../../nova-compute + num_units: 1 + constraints: mem=4G cores=4 + options: + openstack-origin: cloud:trusty-mitaka + config-flags: auto_assign_floating_ip=False + enable-live-migration: false + aa-profile-mode: enforce + debug: true diff --git a/tests/bundles/xenial-mitaka.yaml b/tests/bundles/xenial-mitaka.yaml new file mode 100644 index 00000000..0ef3ef47 --- /dev/null +++ b/tests/bundles/xenial-mitaka.yaml @@ -0,0 +1,86 @@ +series: xenial +relations: +- - nova-compute:image-service + - glance:image-service +- - nova-compute:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:shared-db + - percona-cluster:shared-db +- - nova-cloud-controller:identity-service + - keystone:identity-service +- - nova-cloud-controller:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:cloud-compute + - nova-compute:cloud-compute +- - nova-cloud-controller:image-service + - glance:image-service +- - keystone:shared-db + - percona-cluster:shared-db +- - glance:identity-service + - keystone:identity-service +- - glance:shared-db + - percona-cluster:shared-db +- - glance:amqp + - rabbitmq-server:amqp +- - neutron-gateway:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:quantum-network-service + - neutron-gateway:quantum-network-service +- - neutron-api:shared-db + - percona-cluster:shared-db +- - neutron-api:amqp + - rabbitmq-server:amqp +- - neutron-api:neutron-api + - nova-cloud-controller:neutron-api +- - neutron-api:identity-service + - keystone:identity-service +- - nova-compute:neutron-plugin + - neutron-openvswitch:neutron-plugin +- - rabbitmq-server:amqp + - neutron-openvswitch:amqp +applications: + rabbitmq-server: + charm: cs:~openstack-charmers-next/rabbitmq-server + num_units: 1 + percona-cluster: + charm: cs:~openstack-charmers-next/percona-cluster + num_units: 1 + options: + max-connections: 1000 + innodb-buffer-pool-size: 256M + nova-cloud-controller: + charm: cs:~openstack-charmers-next/nova-cloud-controller + num_units: 1 + options: + network-manager: Neutron + debug: true + neutron-api: + charm: cs:~openstack-charmers-next/neutron-api + num_units: 1 + options: + flat-network-providers: physnet1 + neutron-security-groups: true + keystone: + charm: cs:~openstack-charmers-next/keystone + num_units: 1 + neutron-gateway: + charm: cs:~openstack-charmers-next/neutron-gateway + num_units: 1 + options: + bridge-mappings: physnet1:br-ex + glance: + charm: cs:~openstack-charmers-next/glance + num_units: 1 + neutron-openvswitch: + charm: cs:~openstack-charmers-next/neutron-openvswitch + nova-compute: + charm: ../../../nova-compute + num_units: 1 + constraints: mem=4G cores=4 + options: + config-flags: auto_assign_floating_ip=False + enable-live-migration: false + aa-profile-mode: enforce + ephemeral-device: /dev/vdb + ephemeral-unmount: /mnt + debug: true diff --git a/tests/bundles/xenial-ocata.yaml b/tests/bundles/xenial-ocata.yaml new file mode 100644 index 00000000..e4d0e7d2 --- /dev/null +++ b/tests/bundles/xenial-ocata.yaml @@ -0,0 +1,94 @@ +series: xenial +relations: +- - nova-compute:image-service + - glance:image-service +- - nova-compute:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:shared-db + - percona-cluster:shared-db +- - nova-cloud-controller:identity-service + - keystone:identity-service +- - nova-cloud-controller:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:cloud-compute + - nova-compute:cloud-compute +- - nova-cloud-controller:image-service + - glance:image-service +- - keystone:shared-db + - percona-cluster:shared-db +- - glance:identity-service + - keystone:identity-service +- - glance:shared-db + - percona-cluster:shared-db +- - glance:amqp + - rabbitmq-server:amqp +- - neutron-gateway:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:quantum-network-service + - neutron-gateway:quantum-network-service +- - neutron-api:shared-db + - percona-cluster:shared-db +- - neutron-api:amqp + - rabbitmq-server:amqp +- - neutron-api:neutron-api + - nova-cloud-controller:neutron-api +- - neutron-api:identity-service + - keystone:identity-service +- - nova-compute:neutron-plugin + - neutron-openvswitch:neutron-plugin +- - rabbitmq-server:amqp + - neutron-openvswitch:amqp +applications: + rabbitmq-server: + charm: cs:~openstack-charmers-next/rabbitmq-server + num_units: 1 + percona-cluster: + charm: cs:~openstack-charmers-next/percona-cluster + num_units: 1 + options: + max-connections: 1000 + innodb-buffer-pool-size: 256M + nova-cloud-controller: + charm: cs:~openstack-charmers-next/nova-cloud-controller + num_units: 1 + options: + openstack-origin: cloud:xenial-ocata + network-manager: Neutron + debug: true + neutron-api: + charm: cs:~openstack-charmers-next/neutron-api + num_units: 1 + options: + openstack-origin: cloud:xenial-ocata + flat-network-providers: physnet1 + neutron-security-groups: true + keystone: + charm: cs:~openstack-charmers-next/keystone + num_units: 1 + options: + openstack-origin: cloud:xenial-ocata + neutron-gateway: + charm: cs:~openstack-charmers-next/neutron-gateway + num_units: 1 + options: + openstack-origin: cloud:xenial-ocata + bridge-mappings: physnet1:br-ex + glance: + charm: cs:~openstack-charmers-next/glance + num_units: 1 + options: + openstack-origin: cloud:xenial-ocata + neutron-openvswitch: + charm: cs:~openstack-charmers-next/neutron-openvswitch + nova-compute: + charm: ../../../nova-compute + num_units: 1 + constraints: mem=4G cores=4 + options: + openstack-origin: cloud:xenial-ocata + config-flags: auto_assign_floating_ip=False + enable-live-migration: false + aa-profile-mode: enforce + ephemeral-device: /dev/vdb + ephemeral-unmount: /mnt + debug: true diff --git a/tests/bundles/xenial-pike.yaml b/tests/bundles/xenial-pike.yaml new file mode 100644 index 00000000..4b2faab9 --- /dev/null +++ b/tests/bundles/xenial-pike.yaml @@ -0,0 +1,94 @@ +series: xenial +relations: +- - nova-compute:image-service + - glance:image-service +- - nova-compute:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:shared-db + - percona-cluster:shared-db +- - nova-cloud-controller:identity-service + - keystone:identity-service +- - nova-cloud-controller:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:cloud-compute + - nova-compute:cloud-compute +- - nova-cloud-controller:image-service + - glance:image-service +- - keystone:shared-db + - percona-cluster:shared-db +- - glance:identity-service + - keystone:identity-service +- - glance:shared-db + - percona-cluster:shared-db +- - glance:amqp + - rabbitmq-server:amqp +- - neutron-gateway:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:quantum-network-service + - neutron-gateway:quantum-network-service +- - neutron-api:shared-db + - percona-cluster:shared-db +- - neutron-api:amqp + - rabbitmq-server:amqp +- - neutron-api:neutron-api + - nova-cloud-controller:neutron-api +- - neutron-api:identity-service + - keystone:identity-service +- - nova-compute:neutron-plugin + - neutron-openvswitch:neutron-plugin +- - rabbitmq-server:amqp + - neutron-openvswitch:amqp +applications: + rabbitmq-server: + charm: cs:~openstack-charmers-next/rabbitmq-server + num_units: 1 + percona-cluster: + charm: cs:~openstack-charmers-next/percona-cluster + num_units: 1 + options: + max-connections: 1000 + innodb-buffer-pool-size: 256M + nova-cloud-controller: + charm: cs:~openstack-charmers-next/nova-cloud-controller + num_units: 1 + options: + openstack-origin: cloud:xenial-pike + network-manager: Neutron + debug: true + neutron-api: + charm: cs:~openstack-charmers-next/neutron-api + num_units: 1 + options: + openstack-origin: cloud:xenial-pike + flat-network-providers: physnet1 + neutron-security-groups: true + keystone: + charm: cs:~openstack-charmers-next/keystone + num_units: 1 + options: + openstack-origin: cloud:xenial-pike + neutron-gateway: + charm: cs:~openstack-charmers-next/neutron-gateway + num_units: 1 + options: + openstack-origin: cloud:xenial-pike + bridge-mappings: physnet1:br-ex + glance: + charm: cs:~openstack-charmers-next/glance + num_units: 1 + options: + openstack-origin: cloud:xenial-pike + neutron-openvswitch: + charm: cs:~openstack-charmers-next/neutron-openvswitch + nova-compute: + charm: ../../../nova-compute + num_units: 1 + constraints: mem=4G cores=4 + options: + openstack-origin: cloud:xenial-pike + config-flags: auto_assign_floating_ip=False + enable-live-migration: false + aa-profile-mode: enforce + ephemeral-device: /dev/vdb + ephemeral-unmount: /mnt + debug: true diff --git a/tests/bundles/xenial-queens.yaml b/tests/bundles/xenial-queens.yaml new file mode 100644 index 00000000..aa610817 --- /dev/null +++ b/tests/bundles/xenial-queens.yaml @@ -0,0 +1,94 @@ +series: xenial +relations: +- - nova-compute:image-service + - glance:image-service +- - nova-compute:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:shared-db + - percona-cluster:shared-db +- - nova-cloud-controller:identity-service + - keystone:identity-service +- - nova-cloud-controller:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:cloud-compute + - nova-compute:cloud-compute +- - nova-cloud-controller:image-service + - glance:image-service +- - keystone:shared-db + - percona-cluster:shared-db +- - glance:identity-service + - keystone:identity-service +- - glance:shared-db + - percona-cluster:shared-db +- - glance:amqp + - rabbitmq-server:amqp +- - neutron-gateway:amqp + - rabbitmq-server:amqp +- - nova-cloud-controller:quantum-network-service + - neutron-gateway:quantum-network-service +- - neutron-api:shared-db + - percona-cluster:shared-db +- - neutron-api:amqp + - rabbitmq-server:amqp +- - neutron-api:neutron-api + - nova-cloud-controller:neutron-api +- - neutron-api:identity-service + - keystone:identity-service +- - nova-compute:neutron-plugin + - neutron-openvswitch:neutron-plugin +- - rabbitmq-server:amqp + - neutron-openvswitch:amqp +applications: + rabbitmq-server: + charm: cs:~openstack-charmers-next/rabbitmq-server + num_units: 1 + percona-cluster: + charm: cs:~openstack-charmers-next/percona-cluster + num_units: 1 + options: + max-connections: 1000 + innodb-buffer-pool-size: 256M + nova-cloud-controller: + charm: cs:~openstack-charmers-next/nova-cloud-controller + num_units: 1 + options: + openstack-origin: cloud:xenial-queens + network-manager: Neutron + debug: true + neutron-api: + charm: cs:~openstack-charmers-next/neutron-api + num_units: 1 + options: + openstack-origin: cloud:xenial-queens + flat-network-providers: physnet1 + neutron-security-groups: true + keystone: + charm: cs:~openstack-charmers-next/keystone + num_units: 1 + options: + openstack-origin: cloud:xenial-queens + neutron-gateway: + charm: cs:~openstack-charmers-next/neutron-gateway + num_units: 1 + options: + openstack-origin: cloud:xenial-queens + bridge-mappings: physnet1:br-ex + glance: + charm: cs:~openstack-charmers-next/glance + num_units: 1 + options: + openstack-origin: cloud:xenial-queens + neutron-openvswitch: + charm: cs:~openstack-charmers-next/neutron-openvswitch + nova-compute: + charm: ../../../nova-compute + num_units: 1 + constraints: mem=4G cores=4 + options: + openstack-origin: cloud:xenial-queens + config-flags: auto_assign_floating_ip=False + enable-live-migration: false + aa-profile-mode: enforce + ephemeral-device: /dev/vdb + ephemeral-unmount: /mnt + debug: true diff --git a/tests/gate-basic-bionic-queens b/tests/gate-basic-bionic-queens deleted file mode 100755 index 00e4eee2..00000000 --- a/tests/gate-basic-bionic-queens +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env 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 compute deployment on bionic-queens.""" - -from basic_deployment import NovaBasicDeployment - -if __name__ == '__main__': - deployment = NovaBasicDeployment(series='bionic') - deployment.run_tests() diff --git a/tests/gate-basic-bionic-rocky b/tests/gate-basic-bionic-rocky deleted file mode 100755 index dc48a73e..00000000 --- a/tests/gate-basic-bionic-rocky +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env 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 compute deployment on bionic-rocky.""" - -from basic_deployment import NovaBasicDeployment - -if __name__ == '__main__': - deployment = NovaBasicDeployment(series='bionic', - openstack='cloud:bionic-rocky', - source='cloud:bionic-updates/rocky') - deployment.run_tests() diff --git a/tests/gate-basic-bionic-stein b/tests/gate-basic-bionic-stein deleted file mode 100755 index debb8ba3..00000000 --- a/tests/gate-basic-bionic-stein +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env 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 compute deployment on bionic-stein.""" - -from basic_deployment import NovaBasicDeployment - -if __name__ == '__main__': - deployment = NovaBasicDeployment(series='bionic', - openstack='cloud:bionic-stein', - source='cloud:bionic-stein') - deployment.run_tests() diff --git a/tests/gate-basic-bionic-train b/tests/gate-basic-bionic-train deleted file mode 100755 index 2a98a2ce..00000000 --- a/tests/gate-basic-bionic-train +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env 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 compute deployment on bionic-train.""" - -from basic_deployment import NovaBasicDeployment - -if __name__ == '__main__': - deployment = NovaBasicDeployment(series='bionic', - openstack='cloud:bionic-train', - source='cloud:bionic-train') - deployment.run_tests() diff --git a/tests/gate-basic-trusty-mitaka b/tests/gate-basic-trusty-mitaka deleted file mode 100755 index 8d16ede4..00000000 --- a/tests/gate-basic-trusty-mitaka +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env 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 compute deployment on trusty-mitaka.""" - -from basic_deployment import NovaBasicDeployment - -if __name__ == '__main__': - deployment = NovaBasicDeployment(series='trusty', - openstack='cloud:trusty-mitaka', - source='cloud:trusty-updates/mitaka') - deployment.run_tests() diff --git a/tests/gate-basic-xenial-mitaka b/tests/gate-basic-xenial-mitaka deleted file mode 100755 index 05afafea..00000000 --- a/tests/gate-basic-xenial-mitaka +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env 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 compute deployment on xenial-mitaka.""" - -from basic_deployment import NovaBasicDeployment - -if __name__ == '__main__': - deployment = NovaBasicDeployment(series='xenial') - deployment.run_tests() diff --git a/tests/gate-basic-xenial-ocata b/tests/gate-basic-xenial-ocata deleted file mode 100755 index 3967f2e1..00000000 --- a/tests/gate-basic-xenial-ocata +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env 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 compute deployment on xenial-ocata.""" - -from basic_deployment import NovaBasicDeployment - -if __name__ == '__main__': - deployment = NovaBasicDeployment(series='xenial', - openstack='cloud:xenial-ocata', - source='cloud:xenial-updates/ocata') - deployment.run_tests() diff --git a/tests/gate-basic-xenial-pike b/tests/gate-basic-xenial-pike deleted file mode 100755 index 20e286f8..00000000 --- a/tests/gate-basic-xenial-pike +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env 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 compute deployment on xenial-pike.""" - -from basic_deployment import NovaBasicDeployment - -if __name__ == '__main__': - deployment = NovaBasicDeployment(series='xenial', - openstack='cloud:xenial-pike', - source='cloud:xenial-updates/pike') - deployment.run_tests() diff --git a/tests/gate-basic-xenial-queens b/tests/gate-basic-xenial-queens deleted file mode 100755 index cd405b29..00000000 --- a/tests/gate-basic-xenial-queens +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env 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 compute deployment on xenial-queens.""" - -from basic_deployment import NovaBasicDeployment - -if __name__ == '__main__': - deployment = NovaBasicDeployment(series='xenial', - openstack='cloud:xenial-queens', - source='cloud:xenial-updates/queens') - deployment.run_tests() diff --git a/tests/tests.yaml b/tests/tests.yaml index a03e7bad..cf964751 100644 --- a/tests/tests.yaml +++ b/tests/tests.yaml @@ -1,18 +1,26 @@ -# Bootstrap the model if necessary. -bootstrap: True -# Re-use bootstrap node. -reset: True -# 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. -makefile: [] -# Do not specify juju PPA sources. Juju is presumed to be pre-installed -# and configured in all test runner environments. -#sources: -# Do not specify or rely on system packages. -#packages: -# Do not specify python packages here. Use test-requirements.txt -# and tox instead. ie. The venv is constructed before bundletester -# is invoked. -#python-packages: -reset_timeout: 600 +charm_name: nova-compute +smoke_bundles: +- bionic-train +gate_bundles: +- bionic-train +- bionic-stein +- bionic-rocky +- bionic-queens +- xenial-queens +- xenial-pike +- xenial-ocata +- xenial-mitaka +- trusty-mitaka +dev_bundles: +configure: +- zaza.openstack.charm_tests.glance.setup.add_cirros_image +- zaza.openstack.charm_tests.glance.setup.add_lts_image +- zaza.openstack.charm_tests.keystone.setup.add_demo_user +- zaza.openstack.charm_tests.neutron.setup.basic_overcloud_network +- zaza.openstack.charm_tests.nova.setup.create_flavors +- zaza.openstack.charm_tests.nova.setup.manage_ssh_key +tests: +- zaza.openstack.charm_tests.nova.tests.CirrosGuestCreateTest +- zaza.openstack.charm_tests.nova.tests.LTSGuestCreateTest +- zaza.openstack.charm_tests.nova.tests.NovaCompute +- zaza.openstack.charm_tests.nova.tests.SecurityTests diff --git a/tox.ini b/tox.ini index b6254346..20dbbfc5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,12 @@ -# Classic charm (with amulet): ./tox.ini +# Classic charm (with zaza): ./tox.ini # This file is managed centrally by release-tools and should not be modified # within individual charm repos. See the 'global' dir contents for available # choices of tox.ini for OpenStack Charms: # https://github.com/openstack-charmers/release-tools +# +# TODO: Distill the func test requirements from the lint/unit test +# requirements. They are intertwined. Also, Zaza itself should specify +# all of its own requirements and if it doesn't, fix it there. [tox] envlist = pep8,py3 skipsdist = True @@ -15,17 +19,12 @@ skip_missing_interpreters = False setenv = VIRTUAL_ENV={envdir} PYTHONHASHSEED=0 CHARM_DIR={envdir} - AMULET_SETUP_TIMEOUT=5400 install_command = pip install {opts} {packages} commands = stestr run --slowest {posargs} whitelist_externals = juju -passenv = HOME TERM AMULET_* CS_* OS_* TEST_* - -[testenv:py3] -basepython = python3 -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt +passenv = HOME TERM CS_* OS_* TEST_* +deps = -r{toxinidir}/test-requirements.txt [testenv:py35] basepython = python3.5 @@ -42,6 +41,11 @@ basepython = python3.7 deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt +[testenv:py3] +basepython = python3 +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + [testenv:pep8] basepython = python3 deps = -r{toxinidir}/requirements.txt @@ -82,39 +86,29 @@ basepython = python3 commands = {posargs} [testenv:func-noop] -# DRY RUN - For Debug -basepython = python2.7 -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt +basepython = python3 commands = - bundletester -vl DEBUG -r json -o func-results.json --test-pattern "gate-*" -n --no-destroy + functest-run-suite --help [testenv:func] -# Charm Functional Test -# Run all gate tests which are +x (expected to always pass) -basepython = python2.7 -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt +basepython = python3 commands = - bundletester -vl DEBUG -r json -o func-results.json --test-pattern "gate-*" --no-destroy + functest-run-suite --keep-model [testenv:func-smoke] -# Charm Functional Test -# Run a specific test as an Amulet smoke test (expected to always pass) -basepython = python2.7 -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt +basepython = python3 commands = - bundletester -vl DEBUG -r json -o func-results.json gate-basic-bionic-train --no-destroy + functest-run-suite --keep-model --smoke [testenv:func-dev] -# Charm Functional Test -# Run all development test targets which are +x (may not always pass!) -basepython = python2.7 -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt +basepython = python3 +commands = + functest-run-suite --keep-model --dev + +[testenv:func-target] +basepython = python3 commands = - bundletester -vl DEBUG -r json -o func-results.json --test-pattern "dev-*" --no-destroy + functest-run-suite --keep-model --bundle {posargs} [flake8] ignore = E402,E226