From 7b9b81696720497284ec800296717f359a2fe85a Mon Sep 17 00:00:00 2001 From: Liam Young Date: Sat, 22 Feb 2020 19:16:03 +0000 Subject: [PATCH 01/52] Redumentary tempest support --- zaza/openstack/charm_tests/glance/setup.py | 16 +++ zaza/openstack/charm_tests/tempest/setup.py | 134 ++++++++++++++++++ .../tempest/templates/tempest_v3.py | 95 +++++++++++++ 3 files changed, 245 insertions(+) create mode 100644 zaza/openstack/charm_tests/tempest/setup.py create mode 100644 zaza/openstack/charm_tests/tempest/templates/tempest_v3.py diff --git a/zaza/openstack/charm_tests/glance/setup.py b/zaza/openstack/charm_tests/glance/setup.py index c992917..0a920c2 100644 --- a/zaza/openstack/charm_tests/glance/setup.py +++ b/zaza/openstack/charm_tests/glance/setup.py @@ -18,6 +18,7 @@ import logging import zaza.openstack.utilities.openstack as openstack_utils CIRROS_IMAGE_NAME = "cirros" +CIRROS_ALT_IMAGE_NAME = "cirros_alt" LTS_RELEASE = "bionic" LTS_IMAGE_NAME = "bionic" @@ -77,6 +78,21 @@ def add_cirros_image(glance_client=None, image_name=None): image_name=image_name) +def add_cirros_alt_image(glance_client=None, image_name=None): + """Add a cirros image to the current deployment. + + :param glance: Authenticated glanceclient + :type glance: glanceclient.Client + :param image_name: Label for the image in glance + :type image_name: str + """ + image_name = image_name or CIRROS_ALT_IMAGE_NAME + image_url = openstack_utils.find_cirros_image(arch='x86_64') + add_image(image_url, + glance_client=glance_client, + image_name=image_name) + + def add_lts_image(glance_client=None, image_name=None, release=None): """Add an Ubuntu LTS image to the current deployment. diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py new file mode 100644 index 0000000..c09e61f --- /dev/null +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -0,0 +1,134 @@ +# Copyright 2020 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. + +"""Code for configuring tempest.""" +import urllib.parse +import os + +import zaza.model +import zaza.openstack.utilities.openstack as openstack_utils +import zaza.openstack.charm_tests.glance.setup as glance_setup +import zaza.openstack.charm_tests.tempest.templates.tempest_v3 as tempest_v3 + +SETUP_ENV_VARS = [ + 'OS_TEST_GATEWAY', + 'OS_TEST_CIDR_EXT', + 'OS_TEST_FIP_RANGE', + 'OS_TEST_NAMESERVER', + 'OS_TEST_CIDR_PRIV', + 'OS_TEST_SWIFT_IP', +] + + +def get_app_access_ip(application_name): + try: + app_config = zaza.model.get_application_config(application_name) + except KeyError: + return '' + vip = app_config.get("vip").get("value") + if vip: + ip = vip + else: + unit = zaza.model.get_units(application_name)[0] + ip = unit.public_address + return ip + + +def add_application_ips(ctxt): + ctxt['keystone'] = get_app_access_ip('keystone') + ctxt['dashboard'] = get_app_access_ip('openstack-dashboard') + ctxt['ncc'] = get_app_access_ip('nova-cloud-controller') + + +def add_neutron_config(ctxt, keystone_session): + neutron_client = openstack_utils.get_neutron_session_client( + keystone_session) + for net in neutron_client.list_networks()['networks']: + if net['name'] == 'ext_net': + ctxt['ext_net'] = net['id'] + break + for router in neutron_client.list_routers()['routers']: + if router['name'] == 'provider-router': + ctxt['provider_router_id'] = router['id'] + break + + +def add_glance_config(ctxt, keystone_session): + glance_client = openstack_utils.get_glance_session_client( + keystone_session) + image = openstack_utils.get_images_by_name( + glance_client, glance_setup.CIRROS_IMAGE_NAME) + image_alt = openstack_utils.get_images_by_name( + glance_client, glance_setup.CIRROS_ALT_IMAGE_NAME) + if image: + ctxt['image_id'] = image[0].id + if image_alt: + ctxt['image_alt_id'] = image_alt[0].id + + +def add_keystone_config(ctxt, keystone_session): + keystone_client = openstack_utils.get_keystone_session_client( + keystone_session) + for domain in keystone_client.domains.list(): + if domain.name == 'admin_domain': + ctxt['default_domain_id'] = domain.id + break + + +def add_environment_var_config(ctxt): + for var in SETUP_ENV_VARS: + value = os.environ.get(var) + if value: + ctxt[var.lower()] = value + else: + raise ValueError( + ("Environment variables {} must all be set to run this" + " test").format(', '.join(SETUP_ENV_VARS))) + + +def add_access_protocol(ctxt): + overcloud_auth = openstack_utils.get_overcloud_auth() + ctxt['proto'] = urllib.parse.urlparse(overcloud_auth['OS_AUTH_URL']).scheme + + +def get_tempest_context(): + keystone_session = openstack_utils.get_overcloud_keystone_session() + ctxt = {} + add_application_ips(ctxt) + add_neutron_config(ctxt, keystone_session) + add_glance_config(ctxt, keystone_session) + add_keystone_config(ctxt, keystone_session) + add_environment_var_config(ctxt) + add_access_protocol(ctxt) + return ctxt + + +def render_tempest_config(target_file, ctxt, tempest_template): + with open(target_file, 'w') as f: + f.write(tempest_template.file_contents.format(**ctxt)) + + +def setup_tempest(tempest_template): + try: + os.mkdir('tempest') + except FileExistsError: + pass + render_tempest_config( + 'tempest/tempest.conf', + get_tempest_context(), + tempest_template) + + +def tempest_keystone_v3(): + setup_tempest(tempest_v3) diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py new file mode 100644 index 0000000..9e4727a --- /dev/null +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py @@ -0,0 +1,95 @@ +file_contents = """ +[DEFAULT] +debug = true +use_stderr = false +log_file = tempest.log + +[auth] +test_accounts_file = accounts.yaml +default_credentials_domain_name = admin_domain +admin_username = admin +admin_project_name = admin +admin_password = openstack +admin_domain_name = admin_domain + +[compute] +image_ref = {image_id} +image_ref_alt = {image_alt_id} +flavor_ref = 7 +flavor_ref_alt = 8 +min_compute_nodes = 3 + +# TODO: review this as its release specific +# min_microversion = 2.2 +# max_microversion = latest + +[compute-feature-enabled] +console_output = true +resize = true +live_migration = true +block_migration_for_live_migration = true +attach_encrypted_volume = false + +[identity] +uri = {proto}://{keystone}:5000/v2.0 +uri_v3 = {proto}://{keystone}:5000/v3 +auth_version = v3 +admin_role = Admin +region = RegionOne +default_domain_id = {default_domain_id} +admin_domain_scope = true + +[identity-feature-enabled] +api_v2 = false +api_v3 = true + +[image] +http_image = http://{os_test_swift_ip}:80/swift/v1/images/cirros-0.3.4-x86_64-uec.tar.gz + +[network] +project_network_cidr = {os_test_cidr_priv} +public_network_id = {ext_net} +dns_servers = {os_test_nameserver} +project_networks_reachable = false + +[network-feature-enabled] +ipv6 = false + +[orchestration] +stack_owner_role = Admin +instance_type = m1.small +keypair_name = testkey + +[oslo_concurrency] +lock_path = /tmp + +[scenario] +img_dir = /home/ubuntu/images +img_file = cirros-0.3.4-x86_64-disk.img +img_container_format = bare +img_disk_format = qcow2 + +[validation] +run_validation = true +image_ssh_user = cirros + +[service_available] +ceilometer = true +cinder = true +glance = true +heat = true +horizon = true +ironic = false +neutron = true +nova = true +sahara = false +swift = true +trove = false +zaqar = false + +[volume] +backend_names = cinder-ceph +storage_protocol = ceph + +[volume-feature-enabled] +backup = false""" From 1724e482a1b67a4bbf8b032d3a54782d6959b658 Mon Sep 17 00:00:00 2001 From: Liam Young Date: Sat, 22 Feb 2020 19:49:45 +0000 Subject: [PATCH 02/52] Tempest setup --- zaza/openstack/charm_tests/tempest/setup.py | 24 +++++++++++++++---- .../charm_tests/tempest/templates/accounts.py | 8 +++++++ 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 zaza/openstack/charm_tests/tempest/templates/accounts.py diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index c09e61f..4bd8c4f 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -15,11 +15,13 @@ """Code for configuring tempest.""" import urllib.parse import os +import subprocess import zaza.model import zaza.openstack.utilities.openstack as openstack_utils import zaza.openstack.charm_tests.glance.setup as glance_setup import zaza.openstack.charm_tests.tempest.templates.tempest_v3 as tempest_v3 +import zaza.openstack.charm_tests.tempest.templates.accounts as accounts SETUP_ENV_VARS = [ 'OS_TEST_GATEWAY', @@ -119,16 +121,30 @@ def render_tempest_config(target_file, ctxt, tempest_template): f.write(tempest_template.file_contents.format(**ctxt)) -def setup_tempest(tempest_template): +def setup_tempest(tempest_template, accounts_template): try: - os.mkdir('tempest') + os.makedirs('tempest/etc/') except FileExistsError: pass render_tempest_config( - 'tempest/tempest.conf', + 'tempest/etc/tempest.conf', get_tempest_context(), tempest_template) + render_tempest_config( + 'tempest/etc/accounts.yaml', + get_tempest_context(), + accounts_template) def tempest_keystone_v3(): - setup_tempest(tempest_v3) + setup_tempest(tempest_v3, accounts) + + +def clone_tempest(): + if not os.path.isdir('tempest'): + subprocess.check_call( + [ + 'git', + 'clone', + 'https://opendev.org/openstack/tempest', + 'tempest']) diff --git a/zaza/openstack/charm_tests/tempest/templates/accounts.py b/zaza/openstack/charm_tests/tempest/templates/accounts.py new file mode 100644 index 0000000..3e5329d --- /dev/null +++ b/zaza/openstack/charm_tests/tempest/templates/accounts.py @@ -0,0 +1,8 @@ +file_contents = """ +- username: 'demo' + tenant_name: 'demo' + password: 'pass' +- username: 'alt_demo' + tenant_name: 'alt_demo' + password: 'secret' +""" From 6347bb707f17fa7ec542f53dc39213b300e05951 Mon Sep 17 00:00:00 2001 From: Liam Young Date: Mon, 24 Feb 2020 10:34:48 +0000 Subject: [PATCH 03/52] More updates --- zaza/openstack/charm_tests/glance/setup.py | 16 ---- .../openstack/charm_tests/tempest/__init__.py | 15 ++++ zaza/openstack/charm_tests/tempest/setup.py | 81 ++++++++++++++++++- .../charm_tests/tempest/templates/__init__.py | 15 ++++ .../tempest/templates/tempest_v3.py | 14 ++-- zaza/openstack/charm_tests/tempest/tests.py | 14 ++++ 6 files changed, 128 insertions(+), 27 deletions(-) create mode 100644 zaza/openstack/charm_tests/tempest/__init__.py create mode 100644 zaza/openstack/charm_tests/tempest/templates/__init__.py create mode 100644 zaza/openstack/charm_tests/tempest/tests.py diff --git a/zaza/openstack/charm_tests/glance/setup.py b/zaza/openstack/charm_tests/glance/setup.py index 0a920c2..c992917 100644 --- a/zaza/openstack/charm_tests/glance/setup.py +++ b/zaza/openstack/charm_tests/glance/setup.py @@ -18,7 +18,6 @@ import logging import zaza.openstack.utilities.openstack as openstack_utils CIRROS_IMAGE_NAME = "cirros" -CIRROS_ALT_IMAGE_NAME = "cirros_alt" LTS_RELEASE = "bionic" LTS_IMAGE_NAME = "bionic" @@ -78,21 +77,6 @@ def add_cirros_image(glance_client=None, image_name=None): image_name=image_name) -def add_cirros_alt_image(glance_client=None, image_name=None): - """Add a cirros image to the current deployment. - - :param glance: Authenticated glanceclient - :type glance: glanceclient.Client - :param image_name: Label for the image in glance - :type image_name: str - """ - image_name = image_name or CIRROS_ALT_IMAGE_NAME - image_url = openstack_utils.find_cirros_image(arch='x86_64') - add_image(image_url, - glance_client=glance_client, - image_name=image_name) - - def add_lts_image(glance_client=None, image_name=None, release=None): """Add an Ubuntu LTS image to the current deployment. diff --git a/zaza/openstack/charm_tests/tempest/__init__.py b/zaza/openstack/charm_tests/tempest/__init__.py new file mode 100644 index 0000000..ed3be2f --- /dev/null +++ b/zaza/openstack/charm_tests/tempest/__init__.py @@ -0,0 +1,15 @@ +# Copyright 2018 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. + +"""Collection of code for setting up and using tempest.""" diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 4bd8c4f..3f0a066 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -18,11 +18,15 @@ import os import subprocess import zaza.model +import zaza.utilities.deployment_env as deployment_env import zaza.openstack.utilities.openstack as openstack_utils import zaza.openstack.charm_tests.glance.setup as glance_setup import zaza.openstack.charm_tests.tempest.templates.tempest_v3 as tempest_v3 import zaza.openstack.charm_tests.tempest.templates.accounts as accounts +import keystoneauth1 +import novaclient + SETUP_ENV_VARS = [ 'OS_TEST_GATEWAY', 'OS_TEST_CIDR_EXT', @@ -31,6 +35,9 @@ SETUP_ENV_VARS = [ 'OS_TEST_CIDR_PRIV', 'OS_TEST_SWIFT_IP', ] +TEMPEST_FLAVOR_NAME = 'm1.tempest' +TEMPEST_ALT_FLAVOR_NAME = 'm2.tempest' +TEMPEST_CIRROS_ALT_IMAGE_NAME = 'cirros_alt' def get_app_access_ip(application_name): @@ -53,6 +60,16 @@ def add_application_ips(ctxt): ctxt['ncc'] = get_app_access_ip('nova-cloud-controller') +def add_nova_config(ctxt, keystone_session): + nova_client = openstack_utils.get_nova_session_client( + keystone_session) + for flavor in nova_client.flavors.list(): + if flavor.name == TEMPEST_FLAVOR_NAME: + ctxt['flavor_ref'] = flavor.id + if flavor.name == TEMPEST_ALT_FLAVOR_NAME: + ctxt['flavor_ref_alt'] = flavor.id + + def add_neutron_config(ctxt, keystone_session): neutron_client = openstack_utils.get_neutron_session_client( keystone_session) @@ -72,7 +89,7 @@ def add_glance_config(ctxt, keystone_session): image = openstack_utils.get_images_by_name( glance_client, glance_setup.CIRROS_IMAGE_NAME) image_alt = openstack_utils.get_images_by_name( - glance_client, glance_setup.CIRROS_ALT_IMAGE_NAME) + glance_client, TEMPEST_CIRROS_ALT_IMAGE_NAME) if image: ctxt['image_id'] = image[0].id if image_alt: @@ -89,8 +106,9 @@ def add_keystone_config(ctxt, keystone_session): def add_environment_var_config(ctxt): + deploy_env = deployment_env.get_deployment_context() for var in SETUP_ENV_VARS: - value = os.environ.get(var) + value = deploy_env.get(var) if value: ctxt[var.lower()] = value else: @@ -102,12 +120,19 @@ def add_environment_var_config(ctxt): def add_access_protocol(ctxt): overcloud_auth = openstack_utils.get_overcloud_auth() ctxt['proto'] = urllib.parse.urlparse(overcloud_auth['OS_AUTH_URL']).scheme + ctxt['admin_username'] = overcloud_auth['OS_USERNAME'] + ctxt['admin_password'] = overcloud_auth['OS_PASSWORD'] + ctxt['admin_project_name'] = overcloud_auth['OS_PROJECT_NAME'] + ctxt['admin_domain_name'] = overcloud_auth['OS_DOMAIN_NAME'] + ctxt['default_credentials_domain_name'] = overcloud_auth[ + 'OS_PROJECT_DOMAIN_NAME'] def get_tempest_context(): keystone_session = openstack_utils.get_overcloud_keystone_session() ctxt = {} add_application_ips(ctxt) + add_nova_config(ctxt, keystone_session) add_neutron_config(ctxt, keystone_session) add_glance_config(ctxt, keystone_session) add_keystone_config(ctxt, keystone_session) @@ -136,7 +161,7 @@ def setup_tempest(tempest_template, accounts_template): accounts_template) -def tempest_keystone_v3(): +def render_tempest_config_keystone_v3(): setup_tempest(tempest_v3, accounts) @@ -145,6 +170,54 @@ def clone_tempest(): subprocess.check_call( [ 'git', - 'clone', + 'clone', 'https://opendev.org/openstack/tempest', 'tempest']) + + +def add_cirros_alt_image(): + """Add a cirros image to the current deployment. + + :param glance: Authenticated glanceclient + :type glance: glanceclient.Client + :param image_name: Label for the image in glance + :type image_name: str + """ + image_url = openstack_utils.find_cirros_image(arch='x86_64') + glance_setup.add_image( + image_url, + glance_client=None, + image_name=TEMPEST_CIRROS_ALT_IMAGE_NAME) + + +def add_tempest_flavors(): + keystone_session = openstack_utils.get_overcloud_keystone_session() + nova_client = openstack_utils.get_nova_session_client( + keystone_session) + try: + nova_client.flavors.create( + name=TEMPEST_FLAVOR_NAME, + ram=256, + vcpus=1, + disk=1) + except novaclient.exceptions.Conflict: + pass + try: + nova_client.flavors.create( + name=TEMPEST_ALT_FLAVOR_NAME, + ram=512, + vcpus=1, + disk=1) + except novaclient.exceptions.Conflict: + pass + + +def add_tempest_roles(): + keystone_session = openstack_utils.get_overcloud_keystone_session() + keystone_client = openstack_utils.get_keystone_session_client( + keystone_session) + for role_name in ['Member', 'ResellerAdmin']: + try: + keystone_client.roles.create('Member') + except keystoneauth1.exceptions.http.Conflict: + pass diff --git a/zaza/openstack/charm_tests/tempest/templates/__init__.py b/zaza/openstack/charm_tests/tempest/templates/__init__.py new file mode 100644 index 0000000..1400887 --- /dev/null +++ b/zaza/openstack/charm_tests/tempest/templates/__init__.py @@ -0,0 +1,15 @@ +# Copyright 2018 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. + +"""Collection of templates for tempest.""" diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py index 9e4727a..ea2d88d 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py @@ -6,17 +6,17 @@ log_file = tempest.log [auth] test_accounts_file = accounts.yaml -default_credentials_domain_name = admin_domain -admin_username = admin -admin_project_name = admin -admin_password = openstack -admin_domain_name = admin_domain +default_credentials_domain_name = {default_credentials_domain_name} +admin_username = {admin_username} +admin_project_name = {admin_project_name} +admin_password = {admin_password} +admin_domain_name = {admin_domain_name} [compute] image_ref = {image_id} image_ref_alt = {image_alt_id} -flavor_ref = 7 -flavor_ref_alt = 8 +flavor_ref = {flavor_ref} +flavor_ref_alt = {flavor_ref_alt} min_compute_nodes = 3 # TODO: review this as its release specific diff --git a/zaza/openstack/charm_tests/tempest/tests.py b/zaza/openstack/charm_tests/tempest/tests.py new file mode 100644 index 0000000..86b4f5b --- /dev/null +++ b/zaza/openstack/charm_tests/tempest/tests.py @@ -0,0 +1,14 @@ +import zaza.charm_lifecycle.test +import tempest.cmd.main + + +class TempestTest(): + + test_runner = zaza.charm_lifecycle.test.DIRECT + + def run(self): + the_app = tempest.cmd.main.Main() + return the_app.run([ + 'run', + '--smoke', + '--config', 'tempest/etc/tempest.conf']) From e8624d3297e8f03b682dcb3403454dda5c298132 Mon Sep 17 00:00:00 2001 From: Liam Young Date: Mon, 24 Feb 2020 15:23:16 +0000 Subject: [PATCH 04/52] Fix missing ResellerAdmin --- zaza/openstack/charm_tests/tempest/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 3f0a066..f1c773e 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -218,6 +218,6 @@ def add_tempest_roles(): keystone_session) for role_name in ['Member', 'ResellerAdmin']: try: - keystone_client.roles.create('Member') + keystone_client.roles.create(role_name) except keystoneauth1.exceptions.http.Conflict: pass From be3659c4a2ca13d3c0135cef954510285cf69964 Mon Sep 17 00:00:00 2001 From: Liam Young Date: Tue, 3 Mar 2020 12:49:41 +0000 Subject: [PATCH 05/52] Add support for blacklist/whitelist etc --- zaza/openstack/charm_tests/tempest/tests.py | 41 +++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/zaza/openstack/charm_tests/tempest/tests.py b/zaza/openstack/charm_tests/tempest/tests.py index 86b4f5b..8880756 100644 --- a/zaza/openstack/charm_tests/tempest/tests.py +++ b/zaza/openstack/charm_tests/tempest/tests.py @@ -1,11 +1,52 @@ +import os + +import zaza +import zaza.charm_lifecycle.utils import zaza.charm_lifecycle.test import tempest.cmd.main +import tempfile class TempestTest(): test_runner = zaza.charm_lifecycle.test.DIRECT + def run(self): + charm_config = zaza.charm_lifecycle.utils.get_charm_config() + tempest_options = ['run', '--config', 'tempest/etc/tempest.conf'] + for model_alias in zaza.model.get_juju_model_aliases().keys(): + tempest_test_key = model_alias + if model_alias == zaza.charm_lifecycle.utils.DEFAULT_MODEL_ALIAS: + tempest_test_key = 'default' + config = charm_config['tests_options']['tempest'][tempest_test_key] + if config.get('regex'): + tempest_options.extend(['--regex', config.get('regex')]) + if config.get('black-regex'): + tempest_options.extend(['--black-regex', config.get('black-regex')]) + with tempfile.TemporaryDirectory() as tmpdirname: + if config.get('whitelist'): + white_file = os.path.join(tmpdirname, 'white.cfg') + with open(white_file, 'w') as f: + f.write('\n'.join(config.get('whitelist'))) + f.write('\n') + tempest_options.extend(['--whitelist-file', white_file]) + if config.get('blacklist'): + black_file = os.path.join(tmpdirname, 'black.cfg') + with open(black_file, 'w') as f: + f.write('\n'.join(config.get('blacklist'))) + f.write('\n') + tempest_options.extend(['--blacklist-file', black_file]) + print(tempest_options) + the_app = tempest.cmd.main.Main() + _exec_tempest = the_app.run(tempest_options) + if not _exec_tempest: + return False + return True + +class TempestSmokeTest(): + + test_runner = zaza.charm_lifecycle.test.DIRECT + def run(self): the_app = tempest.cmd.main.Main() return the_app.run([ From 182cda90138b8f46396055285462fa6ce9e8d3bd Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Wed, 4 Mar 2020 02:08:01 +0000 Subject: [PATCH 06/52] Add smoke to TempestTest as blacklist/whitelist/black-regex will be useful with it. --- zaza/openstack/charm_tests/tempest/tests.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/tests.py b/zaza/openstack/charm_tests/tempest/tests.py index 8880756..67ba09b 100644 --- a/zaza/openstack/charm_tests/tempest/tests.py +++ b/zaza/openstack/charm_tests/tempest/tests.py @@ -19,6 +19,8 @@ class TempestTest(): if model_alias == zaza.charm_lifecycle.utils.DEFAULT_MODEL_ALIAS: tempest_test_key = 'default' config = charm_config['tests_options']['tempest'][tempest_test_key] + if config.get('smoke'): + tempest_options.extend(['--smoke']) if config.get('regex'): tempest_options.extend(['--regex', config.get('regex')]) if config.get('black-regex'): @@ -42,14 +44,3 @@ class TempestTest(): if not _exec_tempest: return False return True - -class TempestSmokeTest(): - - test_runner = zaza.charm_lifecycle.test.DIRECT - - def run(self): - the_app = tempest.cmd.main.Main() - return the_app.run([ - 'run', - '--smoke', - '--config', 'tempest/etc/tempest.conf']) From 456b08c032fddea41ab618292542d663fb2dacbf Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Wed, 4 Mar 2020 15:16:18 +0000 Subject: [PATCH 07/52] minor cleanup --- zaza/openstack/charm_tests/tempest/setup.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index f1c773e..d1d2ebe 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -168,11 +168,10 @@ def render_tempest_config_keystone_v3(): def clone_tempest(): if not os.path.isdir('tempest'): subprocess.check_call( - [ - 'git', - 'clone', - 'https://opendev.org/openstack/tempest', - 'tempest']) + ['git', + 'clone', + 'https://opendev.org/openstack/tempest', + 'tempest']) def add_cirros_alt_image(): From 4d8cd803ffb1663325e96294fc9c450e60dc25ef Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Wed, 4 Mar 2020 18:52:34 +0000 Subject: [PATCH 08/52] Convert list of (black-)regex's to a space-separated string --- zaza/openstack/charm_tests/tempest/tests.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/tests.py b/zaza/openstack/charm_tests/tempest/tests.py index 67ba09b..f621a8a 100644 --- a/zaza/openstack/charm_tests/tempest/tests.py +++ b/zaza/openstack/charm_tests/tempest/tests.py @@ -22,9 +22,13 @@ class TempestTest(): if config.get('smoke'): tempest_options.extend(['--smoke']) if config.get('regex'): - tempest_options.extend(['--regex', config.get('regex')]) + tempest_options.extend( + ['--regex', + ' '.join([reg for reg in config.get('regex')])]) if config.get('black-regex'): - tempest_options.extend(['--black-regex', config.get('black-regex')]) + tempest_options.extend( + ['--black-regex', + ' '.join([reg for reg in config.get('black-regex')])]) with tempfile.TemporaryDirectory() as tmpdirname: if config.get('whitelist'): white_file = os.path.join(tmpdirname, 'white.cfg') From 2eaa55bd51c078f82773d531d6be9431512c9439 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Wed, 4 Mar 2020 18:54:51 +0000 Subject: [PATCH 09/52] Drop git clone of tempest --- zaza/openstack/charm_tests/tempest/setup.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index d1d2ebe..09d0be9 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -165,15 +165,6 @@ def render_tempest_config_keystone_v3(): setup_tempest(tempest_v3, accounts) -def clone_tempest(): - if not os.path.isdir('tempest'): - subprocess.check_call( - ['git', - 'clone', - 'https://opendev.org/openstack/tempest', - 'tempest']) - - def add_cirros_alt_image(): """Add a cirros image to the current deployment. From a8a6e72ef30e4786246c4c2ae9ee786cafd98057 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Thu, 5 Mar 2020 14:24:55 +0000 Subject: [PATCH 10/52] Use tempest workspace to avoid conflicts with any charm unit test .stestr config --- zaza/openstack/charm_tests/tempest/setup.py | 6 +++--- zaza/openstack/charm_tests/tempest/tests.py | 10 +++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 09d0be9..cc344ba 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -148,15 +148,15 @@ def render_tempest_config(target_file, ctxt, tempest_template): def setup_tempest(tempest_template, accounts_template): try: - os.makedirs('tempest/etc/') + os.makedirs('tempest_workspace/etc/') except FileExistsError: pass render_tempest_config( - 'tempest/etc/tempest.conf', + 'tempest_workspace/etc/tempest.conf', get_tempest_context(), tempest_template) render_tempest_config( - 'tempest/etc/accounts.yaml', + 'tempest_workspace/etc/accounts.yaml', get_tempest_context(), accounts_template) diff --git a/zaza/openstack/charm_tests/tempest/tests.py b/zaza/openstack/charm_tests/tempest/tests.py index f621a8a..58a31eb 100644 --- a/zaza/openstack/charm_tests/tempest/tests.py +++ b/zaza/openstack/charm_tests/tempest/tests.py @@ -12,8 +12,16 @@ class TempestTest(): test_runner = zaza.charm_lifecycle.test.DIRECT def run(self): + tempest_options = ['init', 'tempest_workspace'] + the_app = tempest.cmd.main.Main() + print(tempest_options) + _exec_tempest = the_app.run(tempest_options) + #if not _exec_tempest: + # return False + charm_config = zaza.charm_lifecycle.utils.get_charm_config() - tempest_options = ['run', '--config', 'tempest/etc/tempest.conf'] + tempest_options = ['run', '--config', 'tempest_workspace/etc/tempest.conf', + '--workspace', 'tempest_workspace'] for model_alias in zaza.model.get_juju_model_aliases().keys(): tempest_test_key = model_alias if model_alias == zaza.charm_lifecycle.utils.DEFAULT_MODEL_ALIAS: From 57594a466bfc19f42bfd23e34390639c26940363 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Thu, 5 Mar 2020 20:21:39 +0000 Subject: [PATCH 11/52] Fix the_app.run ret code checks and don't recreate workspace if already exists --- zaza/openstack/charm_tests/tempest/tests.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/tests.py b/zaza/openstack/charm_tests/tempest/tests.py index 58a31eb..10854e4 100644 --- a/zaza/openstack/charm_tests/tempest/tests.py +++ b/zaza/openstack/charm_tests/tempest/tests.py @@ -7,20 +7,24 @@ import tempest.cmd.main import tempfile + class TempestTest(): test_runner = zaza.charm_lifecycle.test.DIRECT def run(self): - tempest_options = ['init', 'tempest_workspace'] - the_app = tempest.cmd.main.Main() - print(tempest_options) - _exec_tempest = the_app.run(tempest_options) - #if not _exec_tempest: - # return False + tempest_workspace = 'tempst_workspace' + tempest_options = ['init', tempest_workspace] + if not os.path.isdir(tempest_workspace): + the_app = tempest.cmd.main.Main() + print(tempest_options) + _exec_tempest = the_app.run(tempest_options) + if _exec_tempest != 0: + return False charm_config = zaza.charm_lifecycle.utils.get_charm_config() - tempest_options = ['run', '--config', 'tempest_workspace/etc/tempest.conf', + tempest_options = ['run', '--config', + os.path.join(tempest_workspace, 'etc/tempest.conf'), '--workspace', 'tempest_workspace'] for model_alias in zaza.model.get_juju_model_aliases().keys(): tempest_test_key = model_alias @@ -53,6 +57,6 @@ class TempestTest(): print(tempest_options) the_app = tempest.cmd.main.Main() _exec_tempest = the_app.run(tempest_options) - if not _exec_tempest: + if _exec_tempest != 0: return False return True From eff595c6ee7d50adb8702908ec979889d33f6d82 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Mon, 9 Mar 2020 13:54:04 +0000 Subject: [PATCH 12/52] Add render_tempest_config_keystone_v2 for older deployments --- zaza/openstack/charm_tests/tempest/setup.py | 5 + .../tempest/templates/tempest_v2.py | 94 +++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 zaza/openstack/charm_tests/tempest/templates/tempest_v2.py diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index cc344ba..2fd95f4 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -21,6 +21,7 @@ import zaza.model import zaza.utilities.deployment_env as deployment_env import zaza.openstack.utilities.openstack as openstack_utils import zaza.openstack.charm_tests.glance.setup as glance_setup +import zaza.openstack.charm_tests.tempest.templates.tempest_v2 as tempest_v2 import zaza.openstack.charm_tests.tempest.templates.tempest_v3 as tempest_v3 import zaza.openstack.charm_tests.tempest.templates.accounts as accounts @@ -161,6 +162,10 @@ def setup_tempest(tempest_template, accounts_template): accounts_template) +def render_tempest_config_keystone_v2(): + setup_tempest(tempest_v2, accounts) + + def render_tempest_config_keystone_v3(): setup_tempest(tempest_v3, accounts) diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py new file mode 100644 index 0000000..3421910 --- /dev/null +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py @@ -0,0 +1,94 @@ +file_contents = """ +[DEFAULT] +debug = true +use_stderr = false +log_file = tempest.log + +[auth] +test_accounts_file = accounts.yaml +default_credentials_domain_name = {default_credentials_domain_name} +admin_username = {admin_username} +admin_project_name = {admin_project_name} +admin_password = {admin_password} +admin_domain_name = {admin_domain_name} + +[compute] +image_ref = {image_id} +image_ref_alt = {image_alt_id} +flavor_ref = {flavor_ref} +flavor_ref_alt = {flavor_ref_alt} +min_compute_nodes = 3 + +# TODO: review this as its release specific +# min_microversion = 2.2 +# max_microversion = latest + +[compute-feature-enabled] +console_output = true +resize = true +live_migration = true +block_migration_for_live_migration = true +attach_encrypted_volume = false + +[identity] +uri = {proto}://{keystone}:5000/v2.0 +auth_version = v2 +admin_role = Admin +region = RegionOne +default_domain_id = {default_domain_id} +admin_domain_scope = true + +[identity-feature-enabled] +api_v2 = true +api_v3 = false + +[image] +http_image = http://{os_test_swift_ip}:80/swift/v1/images/cirros-0.3.4-x86_64-uec.tar.gz + +[network] +project_network_cidr = {os_test_cidr_priv} +public_network_id = {ext_net} +dns_servers = {os_test_nameserver} +project_networks_reachable = false + +[network-feature-enabled] +ipv6 = false + +[orchestration] +stack_owner_role = Admin +instance_type = m1.small +keypair_name = testkey + +[oslo_concurrency] +lock_path = /tmp + +[scenario] +img_dir = /home/ubuntu/images +img_file = cirros-0.3.4-x86_64-disk.img +img_container_format = bare +img_disk_format = qcow2 + +[validation] +run_validation = true +image_ssh_user = cirros + +[service_available] +ceilometer = true +cinder = true +glance = true +heat = true +horizon = true +ironic = false +neutron = true +nova = true +sahara = false +swift = true +trove = false +zaqar = false + +[volume] +backend_names = cinder-ceph +storage_protocol = ceph + +[volume-feature-enabled] +backup = false""" From f017934c9b890a7e604107b17f63701e7a0753c0 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Mon, 9 Mar 2020 15:57:03 +0000 Subject: [PATCH 13/52] Fix typo in tempest workspace name --- zaza/openstack/charm_tests/tempest/tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zaza/openstack/charm_tests/tempest/tests.py b/zaza/openstack/charm_tests/tempest/tests.py index 10854e4..1626dc5 100644 --- a/zaza/openstack/charm_tests/tempest/tests.py +++ b/zaza/openstack/charm_tests/tempest/tests.py @@ -13,7 +13,7 @@ class TempestTest(): test_runner = zaza.charm_lifecycle.test.DIRECT def run(self): - tempest_workspace = 'tempst_workspace' + tempest_workspace = 'tempest_workspace' tempest_options = ['init', tempest_workspace] if not os.path.isdir(tempest_workspace): the_app = tempest.cmd.main.Main() From 67de027d986df6c20fe6eeac7da653ebb49b8576 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Tue, 10 Mar 2020 20:53:40 +0000 Subject: [PATCH 14/52] Move tempest init to setup.py and use a local workspace path --- zaza/openstack/charm_tests/tempest/setup.py | 17 +++++++++++------ zaza/openstack/charm_tests/tempest/tests.py | 11 ++--------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 2fd95f4..9ffe663 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -15,6 +15,7 @@ """Code for configuring tempest.""" import urllib.parse import os +import shutil import subprocess import zaza.model @@ -24,6 +25,7 @@ import zaza.openstack.charm_tests.glance.setup as glance_setup import zaza.openstack.charm_tests.tempest.templates.tempest_v2 as tempest_v2 import zaza.openstack.charm_tests.tempest.templates.tempest_v3 as tempest_v3 import zaza.openstack.charm_tests.tempest.templates.accounts as accounts +import tempest.cmd.main import keystoneauth1 import novaclient @@ -148,16 +150,18 @@ def render_tempest_config(target_file, ctxt, tempest_template): def setup_tempest(tempest_template, accounts_template): - try: - os.makedirs('tempest_workspace/etc/') - except FileExistsError: - pass + tempest_workspace = 'tempest_workspace' + the_app = tempest.cmd.main.Main() + tempest_options = ['init', '--workspace-path', './.tempest/workspace.yaml', + tempest_workspace] + print(tempest_options) + _exec_tempest = the_app.run(tempest_options) render_tempest_config( - 'tempest_workspace/etc/tempest.conf', + os.path.join(tempest_workspace, 'etc/tempest.conf'), get_tempest_context(), tempest_template) render_tempest_config( - 'tempest_workspace/etc/accounts.yaml', + os.path.join(tempest_workspace, 'etc/accounts.yaml'), get_tempest_context(), accounts_template) @@ -216,3 +220,4 @@ def add_tempest_roles(): keystone_client.roles.create(role_name) except keystoneauth1.exceptions.http.Conflict: pass + diff --git a/zaza/openstack/charm_tests/tempest/tests.py b/zaza/openstack/charm_tests/tempest/tests.py index 1626dc5..a4f97e4 100644 --- a/zaza/openstack/charm_tests/tempest/tests.py +++ b/zaza/openstack/charm_tests/tempest/tests.py @@ -13,18 +13,11 @@ class TempestTest(): test_runner = zaza.charm_lifecycle.test.DIRECT def run(self): - tempest_workspace = 'tempest_workspace' - tempest_options = ['init', tempest_workspace] - if not os.path.isdir(tempest_workspace): - the_app = tempest.cmd.main.Main() - print(tempest_options) - _exec_tempest = the_app.run(tempest_options) - if _exec_tempest != 0: - return False - charm_config = zaza.charm_lifecycle.utils.get_charm_config() + tempest_workspace = 'tempest_workspace' tempest_options = ['run', '--config', os.path.join(tempest_workspace, 'etc/tempest.conf'), + '--workspace-path', './.tempest/workspace.yaml', '--workspace', 'tempest_workspace'] for model_alias in zaza.model.get_juju_model_aliases().keys(): tempest_test_key = model_alias From a1f34e2c0148fafd3686752db37d088ca737dca2 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Wed, 11 Mar 2020 14:22:27 +0000 Subject: [PATCH 15/52] Handle tempest changing to workspace directory --- zaza/openstack/charm_tests/tempest/tests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zaza/openstack/charm_tests/tempest/tests.py b/zaza/openstack/charm_tests/tempest/tests.py index a4f97e4..0641520 100644 --- a/zaza/openstack/charm_tests/tempest/tests.py +++ b/zaza/openstack/charm_tests/tempest/tests.py @@ -49,7 +49,9 @@ class TempestTest(): tempest_options.extend(['--blacklist-file', black_file]) print(tempest_options) the_app = tempest.cmd.main.Main() + project_root = os.getcwd() _exec_tempest = the_app.run(tempest_options) + os.chdir(project_root) if _exec_tempest != 0: return False return True From 4a745e3ab0848927e2f87bafad53289faf2b535a Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Thu, 12 Mar 2020 12:58:21 +0000 Subject: [PATCH 16/52] Align tempest_v2.py with o-c-t v2 tempest.conf.template --- .../charm_tests/tempest/templates/tempest_v2.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py index 3421910..4f40d90 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py @@ -6,17 +6,18 @@ log_file = tempest.log [auth] test_accounts_file = accounts.yaml -default_credentials_domain_name = {default_credentials_domain_name} +default_credentials_domain_name = Default admin_username = {admin_username} -admin_project_name = {admin_project_name} +admin_project_name = admin admin_password = {admin_password} -admin_domain_name = {admin_domain_name} +admin_domain_name = Default [compute] image_ref = {image_id} image_ref_alt = {image_alt_id} flavor_ref = {flavor_ref} flavor_ref_alt = {flavor_ref_alt} +region = RegionOne min_compute_nodes = 3 # TODO: review this as its release specific @@ -35,8 +36,6 @@ uri = {proto}://{keystone}:5000/v2.0 auth_version = v2 admin_role = Admin region = RegionOne -default_domain_id = {default_domain_id} -admin_domain_scope = true [identity-feature-enabled] api_v2 = true @@ -89,6 +88,10 @@ zaqar = false [volume] backend_names = cinder-ceph storage_protocol = ceph +# NOTE(coreycb): Need to enalbe catalog_type, determined by: +# volume_version=$(openstack endpoint list -c 'Service Type' -f value | grep -m 1 volumev3 || +# openstack endpoint list -c 'Service Type' -f value | grep -m 1 volumev2) +# catalog_type = __VOLUME_VERSION__ [volume-feature-enabled] backup = false""" From aa33797879fc20143dc471f11ef3609b38d18470 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Thu, 12 Mar 2020 13:32:21 +0000 Subject: [PATCH 17/52] Updates to add_access_protocol for keystone v2 support --- zaza/openstack/charm_tests/tempest/setup.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 9ffe663..6d7c26e 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -125,10 +125,14 @@ def add_access_protocol(ctxt): ctxt['proto'] = urllib.parse.urlparse(overcloud_auth['OS_AUTH_URL']).scheme ctxt['admin_username'] = overcloud_auth['OS_USERNAME'] ctxt['admin_password'] = overcloud_auth['OS_PASSWORD'] - ctxt['admin_project_name'] = overcloud_auth['OS_PROJECT_NAME'] - ctxt['admin_domain_name'] = overcloud_auth['OS_DOMAIN_NAME'] - ctxt['default_credentials_domain_name'] = overcloud_auth[ - 'OS_PROJECT_DOMAIN_NAME'] + if overcloud_auth['API_VERSION'] == 3: + ctxt['admin_project_name'] = overcloud_auth['OS_PROJECT_NAME'] + ctxt['admin_domain_name'] = overcloud_auth['OS_DOMAIN_NAME'] + ctxt['default_credentials_domain_name'] = overcloud_auth[ + 'OS_PROJECT_DOMAIN_NAME'] + elif overcloud_auth['API_VERSION'] == 2: + #ctxt['admin_tenant_name'] = overcloud_auth['OS_TENANT_NAME'] + pass def get_tempest_context(): From af2cff3c6ccce4b6dfe605813300fdda3d36e5c8 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Fri, 13 Mar 2020 14:20:23 +0000 Subject: [PATCH 18/52] Set tempest debug to false --- zaza/openstack/charm_tests/tempest/templates/tempest_v2.py | 2 +- zaza/openstack/charm_tests/tempest/templates/tempest_v3.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py index 4f40d90..ec95577 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py @@ -1,6 +1,6 @@ file_contents = """ [DEFAULT] -debug = true +debug = false use_stderr = false log_file = tempest.log diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py index ea2d88d..887b0b5 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py @@ -1,6 +1,6 @@ file_contents = """ [DEFAULT] -debug = true +debug = false use_stderr = false log_file = tempest.log From 82a1f1b75de8456d13fa32d405550cd98ccfd96d Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Fri, 13 Mar 2020 17:35:26 +0000 Subject: [PATCH 19/52] Fix tempest run config-file flag --- zaza/openstack/charm_tests/tempest/tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/tests.py b/zaza/openstack/charm_tests/tempest/tests.py index 0641520..27e12ed 100644 --- a/zaza/openstack/charm_tests/tempest/tests.py +++ b/zaza/openstack/charm_tests/tempest/tests.py @@ -15,10 +15,10 @@ class TempestTest(): def run(self): charm_config = zaza.charm_lifecycle.utils.get_charm_config() tempest_workspace = 'tempest_workspace' - tempest_options = ['run', '--config', + tempest_options = ['run', '--config-file', os.path.join(tempest_workspace, 'etc/tempest.conf'), '--workspace-path', './.tempest/workspace.yaml', - '--workspace', 'tempest_workspace'] + '--workspace', tempest_workspace] for model_alias in zaza.model.get_juju_model_aliases().keys(): tempest_test_key = model_alias if model_alias == zaza.charm_lifecycle.utils.DEFAULT_MODEL_ALIAS: From 2b9de3a2b7dab0d53b5e91a11daa986f63f45f0e Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Fri, 13 Mar 2020 20:47:54 +0000 Subject: [PATCH 20/52] Updates to tempest config rendering and init --- zaza/openstack/charm_tests/tempest/setup.py | 28 +++++++++++++++++---- zaza/openstack/charm_tests/tempest/tests.py | 13 +++++++--- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 6d7c26e..04d4bf9 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -154,18 +154,36 @@ def render_tempest_config(target_file, ctxt, tempest_template): def setup_tempest(tempest_template, accounts_template): - tempest_workspace = 'tempest_workspace' + config_dir = '.tempest' + config_etc_dir = os.path.join(config_dir, 'etc') + config_etc_tempest = os.path.join(config_etc_dir, 'tempest.conf') + config_workspace_yaml = os.path.join(config_dir, 'workspace.yaml') + workspace_name = 'workspace' + workspace_dir = os.path.join(config_dir, workspace_name) + workspace_etc_dir = os.path.join(workspace_dir, 'etc') + workspace_etc_accounts = os.path.join(workspace_etc_dir, 'accounts.yaml') + workspace_etc_tempest = os.path.join(workspace_etc_dir, 'tempest.conf') the_app = tempest.cmd.main.Main() - tempest_options = ['init', '--workspace-path', './.tempest/workspace.yaml', - tempest_workspace] + + # note sure this is needed or not + if not os.path.isdir(config_dir): + os.mkdir(config_dir) + os.mkdir(config_etc_dir) + render_tempest_config( + config_etc_tempest, + get_tempest_context(), + tempest_template) + tempest_options = ['init', '--workspace-path', config_workspace_yaml, + '--name', workspace_name, workspace_dir] print(tempest_options) _exec_tempest = the_app.run(tempest_options) + # This was mising /etc/tempest/ and just going to /etc/ render_tempest_config( - os.path.join(tempest_workspace, 'etc/tempest.conf'), + workspace_etc_tempest, get_tempest_context(), tempest_template) render_tempest_config( - os.path.join(tempest_workspace, 'etc/accounts.yaml'), + workspace_etc_accounts, get_tempest_context(), accounts_template) diff --git a/zaza/openstack/charm_tests/tempest/tests.py b/zaza/openstack/charm_tests/tempest/tests.py index 27e12ed..9bc6221 100644 --- a/zaza/openstack/charm_tests/tempest/tests.py +++ b/zaza/openstack/charm_tests/tempest/tests.py @@ -14,11 +14,16 @@ class TempestTest(): def run(self): charm_config = zaza.charm_lifecycle.utils.get_charm_config() - tempest_workspace = 'tempest_workspace' + config_dir = '.tempest' + config_workspace_yaml = os.path.join(config_dir, 'workspace.yaml') + workspace_name = 'workspace' + workspace_dir = os.path.join(config_dir, workspace_name) + workspace_etc_dir = os.path.join(workspace_dir, 'etc') + workspace_etc_tempest = os.path.join(workspace_etc_dir, 'tempest.conf') tempest_options = ['run', '--config-file', - os.path.join(tempest_workspace, 'etc/tempest.conf'), - '--workspace-path', './.tempest/workspace.yaml', - '--workspace', tempest_workspace] + workspace_etc_tempest, + '--workspace-path', config_workspace_yaml, + '--workspace', workspace_name] for model_alias in zaza.model.get_juju_model_aliases().keys(): tempest_test_key = model_alias if model_alias == zaza.charm_lifecycle.utils.DEFAULT_MODEL_ALIAS: From eaca793e522c4d121b074409e5ae61d9a7428721 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Mon, 16 Mar 2020 13:56:29 +0000 Subject: [PATCH 21/52] tmp debug testing --- zaza/openstack/charm_tests/tempest/setup.py | 14 +-- .../tempest/templates/tempest_v2.py | 96 +------------------ .../tempest/templates/tempest_v3.py | 94 +----------------- 3 files changed, 9 insertions(+), 195 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 04d4bf9..7336299 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -138,13 +138,13 @@ def add_access_protocol(ctxt): def get_tempest_context(): keystone_session = openstack_utils.get_overcloud_keystone_session() ctxt = {} - add_application_ips(ctxt) - add_nova_config(ctxt, keystone_session) - add_neutron_config(ctxt, keystone_session) - add_glance_config(ctxt, keystone_session) - add_keystone_config(ctxt, keystone_session) - add_environment_var_config(ctxt) - add_access_protocol(ctxt) + #add_application_ips(ctxt) + #add_nova_config(ctxt, keystone_session) + #add_neutron_config(ctxt, keystone_session) + #add_glance_config(ctxt, keystone_session) + #add_keystone_config(ctxt, keystone_session) + #add_environment_var_config(ctxt) + #add_access_protocol(ctxt) return ctxt diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py index ec95577..aa6b555 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py @@ -1,97 +1,3 @@ file_contents = """ [DEFAULT] -debug = false -use_stderr = false -log_file = tempest.log - -[auth] -test_accounts_file = accounts.yaml -default_credentials_domain_name = Default -admin_username = {admin_username} -admin_project_name = admin -admin_password = {admin_password} -admin_domain_name = Default - -[compute] -image_ref = {image_id} -image_ref_alt = {image_alt_id} -flavor_ref = {flavor_ref} -flavor_ref_alt = {flavor_ref_alt} -region = RegionOne -min_compute_nodes = 3 - -# TODO: review this as its release specific -# min_microversion = 2.2 -# max_microversion = latest - -[compute-feature-enabled] -console_output = true -resize = true -live_migration = true -block_migration_for_live_migration = true -attach_encrypted_volume = false - -[identity] -uri = {proto}://{keystone}:5000/v2.0 -auth_version = v2 -admin_role = Admin -region = RegionOne - -[identity-feature-enabled] -api_v2 = true -api_v3 = false - -[image] -http_image = http://{os_test_swift_ip}:80/swift/v1/images/cirros-0.3.4-x86_64-uec.tar.gz - -[network] -project_network_cidr = {os_test_cidr_priv} -public_network_id = {ext_net} -dns_servers = {os_test_nameserver} -project_networks_reachable = false - -[network-feature-enabled] -ipv6 = false - -[orchestration] -stack_owner_role = Admin -instance_type = m1.small -keypair_name = testkey - -[oslo_concurrency] -lock_path = /tmp - -[scenario] -img_dir = /home/ubuntu/images -img_file = cirros-0.3.4-x86_64-disk.img -img_container_format = bare -img_disk_format = qcow2 - -[validation] -run_validation = true -image_ssh_user = cirros - -[service_available] -ceilometer = true -cinder = true -glance = true -heat = true -horizon = true -ironic = false -neutron = true -nova = true -sahara = false -swift = true -trove = false -zaqar = false - -[volume] -backend_names = cinder-ceph -storage_protocol = ceph -# NOTE(coreycb): Need to enalbe catalog_type, determined by: -# volume_version=$(openstack endpoint list -c 'Service Type' -f value | grep -m 1 volumev3 || -# openstack endpoint list -c 'Service Type' -f value | grep -m 1 volumev2) -# catalog_type = __VOLUME_VERSION__ - -[volume-feature-enabled] -backup = false""" +debug = false""" diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py index 887b0b5..aa6b555 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py @@ -1,95 +1,3 @@ file_contents = """ [DEFAULT] -debug = false -use_stderr = false -log_file = tempest.log - -[auth] -test_accounts_file = accounts.yaml -default_credentials_domain_name = {default_credentials_domain_name} -admin_username = {admin_username} -admin_project_name = {admin_project_name} -admin_password = {admin_password} -admin_domain_name = {admin_domain_name} - -[compute] -image_ref = {image_id} -image_ref_alt = {image_alt_id} -flavor_ref = {flavor_ref} -flavor_ref_alt = {flavor_ref_alt} -min_compute_nodes = 3 - -# TODO: review this as its release specific -# min_microversion = 2.2 -# max_microversion = latest - -[compute-feature-enabled] -console_output = true -resize = true -live_migration = true -block_migration_for_live_migration = true -attach_encrypted_volume = false - -[identity] -uri = {proto}://{keystone}:5000/v2.0 -uri_v3 = {proto}://{keystone}:5000/v3 -auth_version = v3 -admin_role = Admin -region = RegionOne -default_domain_id = {default_domain_id} -admin_domain_scope = true - -[identity-feature-enabled] -api_v2 = false -api_v3 = true - -[image] -http_image = http://{os_test_swift_ip}:80/swift/v1/images/cirros-0.3.4-x86_64-uec.tar.gz - -[network] -project_network_cidr = {os_test_cidr_priv} -public_network_id = {ext_net} -dns_servers = {os_test_nameserver} -project_networks_reachable = false - -[network-feature-enabled] -ipv6 = false - -[orchestration] -stack_owner_role = Admin -instance_type = m1.small -keypair_name = testkey - -[oslo_concurrency] -lock_path = /tmp - -[scenario] -img_dir = /home/ubuntu/images -img_file = cirros-0.3.4-x86_64-disk.img -img_container_format = bare -img_disk_format = qcow2 - -[validation] -run_validation = true -image_ssh_user = cirros - -[service_available] -ceilometer = true -cinder = true -glance = true -heat = true -horizon = true -ironic = false -neutron = true -nova = true -sahara = false -swift = true -trove = false -zaqar = false - -[volume] -backend_names = cinder-ceph -storage_protocol = ceph - -[volume-feature-enabled] -backup = false""" +debug = false""" From 816c6462ca19c15dd4aa9be8a6ad6b53fa87bdd0 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Wed, 22 Apr 2020 17:42:54 +0000 Subject: [PATCH 22/52] Revert to remember --- zaza/openstack/charm_tests/tempest/setup.py | 56 ++++++++++++--------- zaza/openstack/charm_tests/tempest/tests.py | 21 ++++---- 2 files changed, 42 insertions(+), 35 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 7336299..214b816 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -15,7 +15,7 @@ """Code for configuring tempest.""" import urllib.parse import os -import shutil +#import shutil import subprocess import zaza.model @@ -25,7 +25,7 @@ import zaza.openstack.charm_tests.glance.setup as glance_setup import zaza.openstack.charm_tests.tempest.templates.tempest_v2 as tempest_v2 import zaza.openstack.charm_tests.tempest.templates.tempest_v3 as tempest_v3 import zaza.openstack.charm_tests.tempest.templates.accounts as accounts -import tempest.cmd.main +#import tempest.cmd.main import keystoneauth1 import novaclient @@ -154,36 +154,42 @@ def render_tempest_config(target_file, ctxt, tempest_template): def setup_tempest(tempest_template, accounts_template): - config_dir = '.tempest' - config_etc_dir = os.path.join(config_dir, 'etc') - config_etc_tempest = os.path.join(config_etc_dir, 'tempest.conf') - config_workspace_yaml = os.path.join(config_dir, 'workspace.yaml') - workspace_name = 'workspace' - workspace_dir = os.path.join(config_dir, workspace_name) - workspace_etc_dir = os.path.join(workspace_dir, 'etc') - workspace_etc_accounts = os.path.join(workspace_etc_dir, 'accounts.yaml') - workspace_etc_tempest = os.path.join(workspace_etc_dir, 'tempest.conf') - the_app = tempest.cmd.main.Main() + try: + os.makedirs('tempest/etc/') + except FileExistsError: + pass + #config_dir = '.tempest' + #config_etc_dir = os.path.join(config_dir, 'etc') + #config_etc_tempest = os.path.join(config_etc_dir, 'tempest.conf') + #config_workspace_yaml = os.path.join(config_dir, 'workspace.yaml') + #workspace_name = 'workspace' + #workspace_dir = os.path.join(config_dir, workspace_name) + #workspace_etc_dir = os.path.join(workspace_dir, 'etc') + #workspace_etc_accounts = os.path.join(workspace_etc_dir, 'accounts.yaml') + #workspace_etc_tempest = os.path.join(workspace_etc_dir, 'tempest.conf') + #the_app = tempest.cmd.main.Main() # note sure this is needed or not - if not os.path.isdir(config_dir): - os.mkdir(config_dir) - os.mkdir(config_etc_dir) - render_tempest_config( - config_etc_tempest, - get_tempest_context(), - tempest_template) - tempest_options = ['init', '--workspace-path', config_workspace_yaml, - '--name', workspace_name, workspace_dir] - print(tempest_options) - _exec_tempest = the_app.run(tempest_options) + #if not os.path.isdir(config_dir): + # os.mkdir(config_dir) + # os.mkdir(config_etc_dir) + #render_tempest_config( + # config_etc_tempest, + # get_tempest_context(), + # tempest_template) + #tempest_options = ['init', '--workspace-path', config_workspace_yaml, + # '--name', workspace_name, workspace_dir] + #print(tempest_options) + #_exec_tempest = the_app.run(tempest_options) # This was mising /etc/tempest/ and just going to /etc/ render_tempest_config( - workspace_etc_tempest, + 'tempest/etc/tempest.conf', + #workspace_etc_tempest, get_tempest_context(), tempest_template) render_tempest_config( - workspace_etc_accounts, + 'tempest/etc/accounts.yaml', + #workspace_etc_accounts, get_tempest_context(), accounts_template) diff --git a/zaza/openstack/charm_tests/tempest/tests.py b/zaza/openstack/charm_tests/tempest/tests.py index 9bc6221..5e949aa 100644 --- a/zaza/openstack/charm_tests/tempest/tests.py +++ b/zaza/openstack/charm_tests/tempest/tests.py @@ -14,16 +14,17 @@ class TempestTest(): def run(self): charm_config = zaza.charm_lifecycle.utils.get_charm_config() - config_dir = '.tempest' - config_workspace_yaml = os.path.join(config_dir, 'workspace.yaml') - workspace_name = 'workspace' - workspace_dir = os.path.join(config_dir, workspace_name) - workspace_etc_dir = os.path.join(workspace_dir, 'etc') - workspace_etc_tempest = os.path.join(workspace_etc_dir, 'tempest.conf') - tempest_options = ['run', '--config-file', - workspace_etc_tempest, - '--workspace-path', config_workspace_yaml, - '--workspace', workspace_name] + tempest_options = ['run', '--config', 'tempest/etc/tempest.conf'] + #config_dir = '.tempest' + #config_workspace_yaml = os.path.join(config_dir, 'workspace.yaml') + #workspace_name = 'workspace' + #workspace_dir = os.path.join(config_dir, workspace_name) + #workspace_etc_dir = os.path.join(workspace_dir, 'etc') + #workspace_etc_tempest = os.path.join(workspace_etc_dir, 'tempest.conf') + #tempest_options = ['run', '--config-file', + # workspace_etc_tempest, + # '--workspace-path', config_workspace_yaml, + # '--workspace', workspace_name] for model_alias in zaza.model.get_juju_model_aliases().keys(): tempest_test_key = model_alias if model_alias == zaza.charm_lifecycle.utils.DEFAULT_MODEL_ALIAS: From 27cc4ebdcf21e5efe966de6e8d3d7d4198155f91 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Wed, 22 Apr 2020 18:53:15 +0000 Subject: [PATCH 23/52] Switch to running tempest with subprocess and use workspace --- zaza/openstack/charm_tests/tempest/setup.py | 21 ++++++++++++++------- zaza/openstack/charm_tests/tempest/tests.py | 16 ++++++++++------ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 214b816..9789d1e 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -15,7 +15,7 @@ """Code for configuring tempest.""" import urllib.parse import os -#import shutil +import shutil import subprocess import zaza.model @@ -154,10 +154,17 @@ def render_tempest_config(target_file, ctxt, tempest_template): def setup_tempest(tempest_template, accounts_template): - try: - os.makedirs('tempest/etc/') - except FileExistsError: - pass + #try: + # os.makedirs('tempest/etc/') + #except FileExistsError: + # pass + if os.path.isdir('tempest-workspace'): + try: + subprocess.check_call(['tempest', 'workspace', 'remove', '--rmdir', '--name', 'tempest-workspace']) + except subprocess.CalledProcessError: + pass + #shutil.rmtree('tempest-workspace') + subprocess.check_call(['tempest', 'init', 'tempest-workspace']) #config_dir = '.tempest' #config_etc_dir = os.path.join(config_dir, 'etc') #config_etc_tempest = os.path.join(config_etc_dir, 'tempest.conf') @@ -183,12 +190,12 @@ def setup_tempest(tempest_template, accounts_template): #_exec_tempest = the_app.run(tempest_options) # This was mising /etc/tempest/ and just going to /etc/ render_tempest_config( - 'tempest/etc/tempest.conf', + 'tempest-workspace/etc/tempest.conf', #workspace_etc_tempest, get_tempest_context(), tempest_template) render_tempest_config( - 'tempest/etc/accounts.yaml', + 'tempest-workspace/etc/accounts.yaml', #workspace_etc_accounts, get_tempest_context(), accounts_template) diff --git a/zaza/openstack/charm_tests/tempest/tests.py b/zaza/openstack/charm_tests/tempest/tests.py index 5e949aa..a4360a9 100644 --- a/zaza/openstack/charm_tests/tempest/tests.py +++ b/zaza/openstack/charm_tests/tempest/tests.py @@ -1,4 +1,5 @@ import os +import subprocess import zaza import zaza.charm_lifecycle.utils @@ -14,7 +15,8 @@ class TempestTest(): def run(self): charm_config = zaza.charm_lifecycle.utils.get_charm_config() - tempest_options = ['run', '--config', 'tempest/etc/tempest.conf'] + tempest_options = ['run', '--workspace', 'tempest-workspace', + '--config', 'tempest-workspace/etc/tempest.conf'] #config_dir = '.tempest' #config_workspace_yaml = os.path.join(config_dir, 'workspace.yaml') #workspace_name = 'workspace' @@ -54,10 +56,12 @@ class TempestTest(): f.write('\n') tempest_options.extend(['--blacklist-file', black_file]) print(tempest_options) - the_app = tempest.cmd.main.Main() - project_root = os.getcwd() - _exec_tempest = the_app.run(tempest_options) - os.chdir(project_root) - if _exec_tempest != 0: + #the_app = tempest.cmd.main.Main() + #project_root = os.getcwd() + #_exec_tempest = the_app.run(tempest_options) + #os.chdir(project_root) + try: + subprocess.check_call(tempest_options) + except subprocess.CalledProcessError: return False return True From 411951d1a1f99308a3fd98940a3d6cb596ce3575 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Wed, 22 Apr 2020 20:35:18 +0000 Subject: [PATCH 24/52] uncomment get_tempest_context --- zaza/openstack/charm_tests/tempest/setup.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 9789d1e..6bb900b 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -138,13 +138,13 @@ def add_access_protocol(ctxt): def get_tempest_context(): keystone_session = openstack_utils.get_overcloud_keystone_session() ctxt = {} - #add_application_ips(ctxt) - #add_nova_config(ctxt, keystone_session) - #add_neutron_config(ctxt, keystone_session) - #add_glance_config(ctxt, keystone_session) - #add_keystone_config(ctxt, keystone_session) - #add_environment_var_config(ctxt) - #add_access_protocol(ctxt) + add_application_ips(ctxt) + add_nova_config(ctxt, keystone_session) + add_neutron_config(ctxt, keystone_session) + add_glance_config(ctxt, keystone_session) + add_keystone_config(ctxt, keystone_session) + add_environment_var_config(ctxt) + add_access_protocol(ctxt) return ctxt From 2df890cabf8a0204d2ea74bdfe8b068c19ddb853 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Thu, 23 Apr 2020 13:25:19 +0000 Subject: [PATCH 25/52] s/run/tempest run/ --- zaza/openstack/charm_tests/tempest/tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zaza/openstack/charm_tests/tempest/tests.py b/zaza/openstack/charm_tests/tempest/tests.py index a4360a9..10a2298 100644 --- a/zaza/openstack/charm_tests/tempest/tests.py +++ b/zaza/openstack/charm_tests/tempest/tests.py @@ -15,7 +15,7 @@ class TempestTest(): def run(self): charm_config = zaza.charm_lifecycle.utils.get_charm_config() - tempest_options = ['run', '--workspace', 'tempest-workspace', + tempest_options = ['tempest', 'run', '--workspace', 'tempest-workspace', '--config', 'tempest-workspace/etc/tempest.conf'] #config_dir = '.tempest' #config_workspace_yaml = os.path.join(config_dir, 'workspace.yaml') From f4c150f3e70e71dfba4d039b90655bd3e93c37f2 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Thu, 23 Apr 2020 15:23:49 +0000 Subject: [PATCH 26/52] restore templates --- .../tempest/templates/tempest_v2.py | 96 ++++++++++++++++++- .../tempest/templates/tempest_v3.py | 94 +++++++++++++++++- 2 files changed, 188 insertions(+), 2 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py index aa6b555..ec95577 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py @@ -1,3 +1,97 @@ file_contents = """ [DEFAULT] -debug = false""" +debug = false +use_stderr = false +log_file = tempest.log + +[auth] +test_accounts_file = accounts.yaml +default_credentials_domain_name = Default +admin_username = {admin_username} +admin_project_name = admin +admin_password = {admin_password} +admin_domain_name = Default + +[compute] +image_ref = {image_id} +image_ref_alt = {image_alt_id} +flavor_ref = {flavor_ref} +flavor_ref_alt = {flavor_ref_alt} +region = RegionOne +min_compute_nodes = 3 + +# TODO: review this as its release specific +# min_microversion = 2.2 +# max_microversion = latest + +[compute-feature-enabled] +console_output = true +resize = true +live_migration = true +block_migration_for_live_migration = true +attach_encrypted_volume = false + +[identity] +uri = {proto}://{keystone}:5000/v2.0 +auth_version = v2 +admin_role = Admin +region = RegionOne + +[identity-feature-enabled] +api_v2 = true +api_v3 = false + +[image] +http_image = http://{os_test_swift_ip}:80/swift/v1/images/cirros-0.3.4-x86_64-uec.tar.gz + +[network] +project_network_cidr = {os_test_cidr_priv} +public_network_id = {ext_net} +dns_servers = {os_test_nameserver} +project_networks_reachable = false + +[network-feature-enabled] +ipv6 = false + +[orchestration] +stack_owner_role = Admin +instance_type = m1.small +keypair_name = testkey + +[oslo_concurrency] +lock_path = /tmp + +[scenario] +img_dir = /home/ubuntu/images +img_file = cirros-0.3.4-x86_64-disk.img +img_container_format = bare +img_disk_format = qcow2 + +[validation] +run_validation = true +image_ssh_user = cirros + +[service_available] +ceilometer = true +cinder = true +glance = true +heat = true +horizon = true +ironic = false +neutron = true +nova = true +sahara = false +swift = true +trove = false +zaqar = false + +[volume] +backend_names = cinder-ceph +storage_protocol = ceph +# NOTE(coreycb): Need to enalbe catalog_type, determined by: +# volume_version=$(openstack endpoint list -c 'Service Type' -f value | grep -m 1 volumev3 || +# openstack endpoint list -c 'Service Type' -f value | grep -m 1 volumev2) +# catalog_type = __VOLUME_VERSION__ + +[volume-feature-enabled] +backup = false""" diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py index aa6b555..887b0b5 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py @@ -1,3 +1,95 @@ file_contents = """ [DEFAULT] -debug = false""" +debug = false +use_stderr = false +log_file = tempest.log + +[auth] +test_accounts_file = accounts.yaml +default_credentials_domain_name = {default_credentials_domain_name} +admin_username = {admin_username} +admin_project_name = {admin_project_name} +admin_password = {admin_password} +admin_domain_name = {admin_domain_name} + +[compute] +image_ref = {image_id} +image_ref_alt = {image_alt_id} +flavor_ref = {flavor_ref} +flavor_ref_alt = {flavor_ref_alt} +min_compute_nodes = 3 + +# TODO: review this as its release specific +# min_microversion = 2.2 +# max_microversion = latest + +[compute-feature-enabled] +console_output = true +resize = true +live_migration = true +block_migration_for_live_migration = true +attach_encrypted_volume = false + +[identity] +uri = {proto}://{keystone}:5000/v2.0 +uri_v3 = {proto}://{keystone}:5000/v3 +auth_version = v3 +admin_role = Admin +region = RegionOne +default_domain_id = {default_domain_id} +admin_domain_scope = true + +[identity-feature-enabled] +api_v2 = false +api_v3 = true + +[image] +http_image = http://{os_test_swift_ip}:80/swift/v1/images/cirros-0.3.4-x86_64-uec.tar.gz + +[network] +project_network_cidr = {os_test_cidr_priv} +public_network_id = {ext_net} +dns_servers = {os_test_nameserver} +project_networks_reachable = false + +[network-feature-enabled] +ipv6 = false + +[orchestration] +stack_owner_role = Admin +instance_type = m1.small +keypair_name = testkey + +[oslo_concurrency] +lock_path = /tmp + +[scenario] +img_dir = /home/ubuntu/images +img_file = cirros-0.3.4-x86_64-disk.img +img_container_format = bare +img_disk_format = qcow2 + +[validation] +run_validation = true +image_ssh_user = cirros + +[service_available] +ceilometer = true +cinder = true +glance = true +heat = true +horizon = true +ironic = false +neutron = true +nova = true +sahara = false +swift = true +trove = false +zaqar = false + +[volume] +backend_names = cinder-ceph +storage_protocol = ceph + +[volume-feature-enabled] +backup = false""" From 635866afe4a5d8c506d9b3c92142aba7ee9b4660 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Thu, 23 Apr 2020 18:51:43 +0000 Subject: [PATCH 27/52] cleanup --- zaza/openstack/charm_tests/tempest/setup.py | 37 +++------------------ zaza/openstack/charm_tests/tempest/tests.py | 14 -------- 2 files changed, 4 insertions(+), 47 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 6bb900b..cae3ab5 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -25,7 +25,6 @@ import zaza.openstack.charm_tests.glance.setup as glance_setup import zaza.openstack.charm_tests.tempest.templates.tempest_v2 as tempest_v2 import zaza.openstack.charm_tests.tempest.templates.tempest_v3 as tempest_v3 import zaza.openstack.charm_tests.tempest.templates.accounts as accounts -#import tempest.cmd.main import keystoneauth1 import novaclient @@ -154,49 +153,21 @@ def render_tempest_config(target_file, ctxt, tempest_template): def setup_tempest(tempest_template, accounts_template): - #try: - # os.makedirs('tempest/etc/') - #except FileExistsError: - # pass if os.path.isdir('tempest-workspace'): try: subprocess.check_call(['tempest', 'workspace', 'remove', '--rmdir', '--name', 'tempest-workspace']) except subprocess.CalledProcessError: pass - #shutil.rmtree('tempest-workspace') - subprocess.check_call(['tempest', 'init', 'tempest-workspace']) - #config_dir = '.tempest' - #config_etc_dir = os.path.join(config_dir, 'etc') - #config_etc_tempest = os.path.join(config_etc_dir, 'tempest.conf') - #config_workspace_yaml = os.path.join(config_dir, 'workspace.yaml') - #workspace_name = 'workspace' - #workspace_dir = os.path.join(config_dir, workspace_name) - #workspace_etc_dir = os.path.join(workspace_dir, 'etc') - #workspace_etc_accounts = os.path.join(workspace_etc_dir, 'accounts.yaml') - #workspace_etc_tempest = os.path.join(workspace_etc_dir, 'tempest.conf') - #the_app = tempest.cmd.main.Main() - - # note sure this is needed or not - #if not os.path.isdir(config_dir): - # os.mkdir(config_dir) - # os.mkdir(config_etc_dir) - #render_tempest_config( - # config_etc_tempest, - # get_tempest_context(), - # tempest_template) - #tempest_options = ['init', '--workspace-path', config_workspace_yaml, - # '--name', workspace_name, workspace_dir] - #print(tempest_options) - #_exec_tempest = the_app.run(tempest_options) - # This was mising /etc/tempest/ and just going to /etc/ + try: + subprocess.check_call(['tempest', 'init', 'tempest-workspace']) + except subprocess.CalledProcessError: + pass render_tempest_config( 'tempest-workspace/etc/tempest.conf', - #workspace_etc_tempest, get_tempest_context(), tempest_template) render_tempest_config( 'tempest-workspace/etc/accounts.yaml', - #workspace_etc_accounts, get_tempest_context(), accounts_template) diff --git a/zaza/openstack/charm_tests/tempest/tests.py b/zaza/openstack/charm_tests/tempest/tests.py index 10a2298..dfdc247 100644 --- a/zaza/openstack/charm_tests/tempest/tests.py +++ b/zaza/openstack/charm_tests/tempest/tests.py @@ -17,16 +17,6 @@ class TempestTest(): charm_config = zaza.charm_lifecycle.utils.get_charm_config() tempest_options = ['tempest', 'run', '--workspace', 'tempest-workspace', '--config', 'tempest-workspace/etc/tempest.conf'] - #config_dir = '.tempest' - #config_workspace_yaml = os.path.join(config_dir, 'workspace.yaml') - #workspace_name = 'workspace' - #workspace_dir = os.path.join(config_dir, workspace_name) - #workspace_etc_dir = os.path.join(workspace_dir, 'etc') - #workspace_etc_tempest = os.path.join(workspace_etc_dir, 'tempest.conf') - #tempest_options = ['run', '--config-file', - # workspace_etc_tempest, - # '--workspace-path', config_workspace_yaml, - # '--workspace', workspace_name] for model_alias in zaza.model.get_juju_model_aliases().keys(): tempest_test_key = model_alias if model_alias == zaza.charm_lifecycle.utils.DEFAULT_MODEL_ALIAS: @@ -56,10 +46,6 @@ class TempestTest(): f.write('\n') tempest_options.extend(['--blacklist-file', black_file]) print(tempest_options) - #the_app = tempest.cmd.main.Main() - #project_root = os.getcwd() - #_exec_tempest = the_app.run(tempest_options) - #os.chdir(project_root) try: subprocess.check_call(tempest_options) except subprocess.CalledProcessError: From 9e3b2f74165d038cf61ed3db01569fea0017ac45 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Mon, 27 Apr 2020 16:57:24 +0000 Subject: [PATCH 28/52] Add catalog_type tempest config support --- zaza/openstack/charm_tests/tempest/setup.py | 12 ++++++++++++ .../charm_tests/tempest/templates/tempest_v2.py | 5 +---- .../charm_tests/tempest/templates/tempest_v3.py | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index cae3ab5..73480df 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -98,6 +98,17 @@ def add_glance_config(ctxt, keystone_session): ctxt['image_alt_id'] = image_alt[0].id +def add_cinder_config(ctxt, keystone_session): + volume_types = ['volumev2', 'volumev3'] + keystone_client = openstack_utils.get_keystone_session_client( + keystone_session) + for volume_type in volume_types: + service = keystone_client.services.list(type=volume_type) + if service: + ctxt['catalog_type'] = volume_type + break + + def add_keystone_config(ctxt, keystone_session): keystone_client = openstack_utils.get_keystone_session_client( keystone_session) @@ -141,6 +152,7 @@ def get_tempest_context(): add_nova_config(ctxt, keystone_session) add_neutron_config(ctxt, keystone_session) add_glance_config(ctxt, keystone_session) + add_cinder_config(ctxt, keystone_session) add_keystone_config(ctxt, keystone_session) add_environment_var_config(ctxt) add_access_protocol(ctxt) diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py index ec95577..e4b94ba 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py @@ -88,10 +88,7 @@ zaqar = false [volume] backend_names = cinder-ceph storage_protocol = ceph -# NOTE(coreycb): Need to enalbe catalog_type, determined by: -# volume_version=$(openstack endpoint list -c 'Service Type' -f value | grep -m 1 volumev3 || -# openstack endpoint list -c 'Service Type' -f value | grep -m 1 volumev2) -# catalog_type = __VOLUME_VERSION__ +catalog_type = {catalog_type} [volume-feature-enabled] backup = false""" diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py index 887b0b5..6f71765 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py @@ -90,6 +90,7 @@ zaqar = false [volume] backend_names = cinder-ceph storage_protocol = ceph +catalog_type = {catalog_type} [volume-feature-enabled] backup = false""" From 8a39e07cbf5919da9128759bbd8d15ec784352e6 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Thu, 30 Apr 2020 14:54:20 +0000 Subject: [PATCH 29/52] Set disable_ssl_certificate_validation to true to deal with self-signed certs --- zaza/openstack/charm_tests/tempest/templates/tempest_v2.py | 1 + zaza/openstack/charm_tests/tempest/templates/tempest_v3.py | 1 + 2 files changed, 2 insertions(+) diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py index e4b94ba..ecca5ce 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py @@ -36,6 +36,7 @@ uri = {proto}://{keystone}:5000/v2.0 auth_version = v2 admin_role = Admin region = RegionOne +disable_ssl_certificate_validation = true [identity-feature-enabled] api_v2 = true diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py index 6f71765..f189ad5 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py @@ -38,6 +38,7 @@ admin_role = Admin region = RegionOne default_domain_id = {default_domain_id} admin_domain_scope = true +disable_ssl_certificate_validation = true [identity-feature-enabled] api_v2 = false From 19be6f7d48e9af8b49630dffc92e8f93149418b6 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Mon, 18 May 2020 18:04:04 +0000 Subject: [PATCH 30/52] Fix copyright --- zaza/openstack/charm_tests/tempest/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zaza/openstack/charm_tests/tempest/__init__.py b/zaza/openstack/charm_tests/tempest/__init__.py index ed3be2f..9703646 100644 --- a/zaza/openstack/charm_tests/tempest/__init__.py +++ b/zaza/openstack/charm_tests/tempest/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2018 Canonical Ltd. +# Copyright 2020 Canonical Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From a21ddd33e6dcf1976d615561627f89a744a0c4e8 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Mon, 18 May 2020 20:04:47 +0000 Subject: [PATCH 31/52] Code cleanup --- zaza/openstack/charm_tests/tempest/setup.py | 138 ++++++++++++++++-- .../charm_tests/tempest/templates/__init__.py | 2 +- zaza/openstack/charm_tests/tempest/tests.py | 30 +++- 3 files changed, 153 insertions(+), 17 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 73480df..59b3b8b 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -13,6 +13,7 @@ # limitations under the License. """Code for configuring tempest.""" + import urllib.parse import os import shutil @@ -43,6 +44,13 @@ TEMPEST_CIRROS_ALT_IMAGE_NAME = 'cirros_alt' def get_app_access_ip(application_name): + """Get the application's access IP + + :param application_name: Name of application + :type application_name: str + :returns: Application's access IP + :rtype: str + """ try: app_config = zaza.model.get_application_config(application_name) except KeyError: @@ -57,12 +65,28 @@ def get_app_access_ip(application_name): def add_application_ips(ctxt): + """Add application access IPs to context + + :param ctxt: Context dictionary + :type ctxt: dict + :returns: None + :rtype: None + """ ctxt['keystone'] = get_app_access_ip('keystone') ctxt['dashboard'] = get_app_access_ip('openstack-dashboard') ctxt['ncc'] = get_app_access_ip('nova-cloud-controller') def add_nova_config(ctxt, keystone_session): + """Add nova config to context + + :param ctxt: Context dictionary + :type ctxt: dict + :returns keystone_session: keystoneauth1.session.Session object + :type: keystoneauth1.session.Session + :returns: None + :rtype: None + """ nova_client = openstack_utils.get_nova_session_client( keystone_session) for flavor in nova_client.flavors.list(): @@ -73,6 +97,15 @@ def add_nova_config(ctxt, keystone_session): def add_neutron_config(ctxt, keystone_session): + """Add neutron config to context + + :param ctxt: Context dictionary + :type ctxt: dict + :returns keystone_session: keystoneauth1.session.Session object + :type: keystoneauth1.session.Session + :returns: None + :rtype: None + """ neutron_client = openstack_utils.get_neutron_session_client( keystone_session) for net in neutron_client.list_networks()['networks']: @@ -86,6 +119,15 @@ def add_neutron_config(ctxt, keystone_session): def add_glance_config(ctxt, keystone_session): + """Add glance config to context + + :param ctxt: Context dictionary + :type ctxt: dict + :returns keystone_session: keystoneauth1.session.Session object + :type: keystoneauth1.session.Session + :returns: None + :rtype: None + """ glance_client = openstack_utils.get_glance_session_client( keystone_session) image = openstack_utils.get_images_by_name( @@ -99,6 +141,15 @@ def add_glance_config(ctxt, keystone_session): def add_cinder_config(ctxt, keystone_session): + """Add cinder config to context + + :param ctxt: Context dictionary + :type ctxt: dict + :returns keystone_session: keystoneauth1.session.Session object + :type: keystoneauth1.session.Session + :returns: None + :rtype: None + """ volume_types = ['volumev2', 'volumev3'] keystone_client = openstack_utils.get_keystone_session_client( keystone_session) @@ -110,6 +161,15 @@ def add_cinder_config(ctxt, keystone_session): def add_keystone_config(ctxt, keystone_session): + """Add keystone config to context + + :param ctxt: Context dictionary + :type ctxt: dict + :returns keystone_session: keystoneauth1.session.Session object + :type: keystoneauth1.session.Session + :returns: None + :rtype: None + """ keystone_client = openstack_utils.get_keystone_session_client( keystone_session) for domain in keystone_client.domains.list(): @@ -119,6 +179,13 @@ def add_keystone_config(ctxt, keystone_session): def add_environment_var_config(ctxt): + """Add environment variable config to context + + :param ctxt: Context dictionary + :type ctxt: dict + :returns: None + :rtype: None + """ deploy_env = deployment_env.get_deployment_context() for var in SETUP_ENV_VARS: value = deploy_env.get(var) @@ -130,7 +197,14 @@ def add_environment_var_config(ctxt): " test").format(', '.join(SETUP_ENV_VARS))) -def add_access_protocol(ctxt): +def add_auth_config(ctxt): + """Add authorization config to context + + :param ctxt: Context dictionary + :type ctxt: dict + :returns: None + :rtype: None + """ overcloud_auth = openstack_utils.get_overcloud_auth() ctxt['proto'] = urllib.parse.urlparse(overcloud_auth['OS_AUTH_URL']).scheme ctxt['admin_username'] = overcloud_auth['OS_USERNAME'] @@ -140,12 +214,14 @@ def add_access_protocol(ctxt): ctxt['admin_domain_name'] = overcloud_auth['OS_DOMAIN_NAME'] ctxt['default_credentials_domain_name'] = overcloud_auth[ 'OS_PROJECT_DOMAIN_NAME'] - elif overcloud_auth['API_VERSION'] == 2: - #ctxt['admin_tenant_name'] = overcloud_auth['OS_TENANT_NAME'] - pass def get_tempest_context(): + """Generate the tempest config context + + :returns: Context dictionary + :rtype: dict + """ keystone_session = openstack_utils.get_overcloud_keystone_session() ctxt = {} add_application_ips(ctxt) @@ -155,16 +231,37 @@ def get_tempest_context(): add_cinder_config(ctxt, keystone_session) add_keystone_config(ctxt, keystone_session) add_environment_var_config(ctxt) - add_access_protocol(ctxt) + add_auth_config(ctxt) return ctxt -def render_tempest_config(target_file, ctxt, tempest_template): +def render_tempest_config(target_file, ctxt, template): + """Render tempest config for specified config file and template + + :param target_file: Name of file to render config to + :type target_file: str + :param ctxt: Context dictionary + :type ctxt: dict + :param template: Template module + :type template: module + :returns: None + :rtype: None + """ + # TODO: switch to jinja2 and generate config based on available services with open(target_file, 'w') as f: f.write(tempest_template.file_contents.format(**ctxt)) def setup_tempest(tempest_template, accounts_template): + """Initialize tempest and render tempest config + + :param tempest_template: tempest.conf template + :type tempest_template: module + :param accounts_template: accounts.yaml template + :type accounts_template: module + :returns: None + :rtype: None + """ if os.path.isdir('tempest-workspace'): try: subprocess.check_call(['tempest', 'workspace', 'remove', '--rmdir', '--name', 'tempest-workspace']) @@ -185,20 +282,28 @@ def setup_tempest(tempest_template, accounts_template): def render_tempest_config_keystone_v2(): + """Render tempest config for Keystone V2 API + + :returns: None + :rtype: None + """ setup_tempest(tempest_v2, accounts) def render_tempest_config_keystone_v3(): + """Render tempest config for Keystone V3 API + + :returns: None + :rtype: None + """ setup_tempest(tempest_v3, accounts) def add_cirros_alt_image(): - """Add a cirros image to the current deployment. + """Add cirros alternate image to overcloud - :param glance: Authenticated glanceclient - :type glance: glanceclient.Client - :param image_name: Label for the image in glance - :type image_name: str + :returns: None + :rtype: None """ image_url = openstack_utils.find_cirros_image(arch='x86_64') glance_setup.add_image( @@ -208,6 +313,11 @@ def add_cirros_alt_image(): def add_tempest_flavors(): + """Add tempest flavors to overcloud + + :returns: None + :rtype: None + """ keystone_session = openstack_utils.get_overcloud_keystone_session() nova_client = openstack_utils.get_nova_session_client( keystone_session) @@ -230,6 +340,11 @@ def add_tempest_flavors(): def add_tempest_roles(): + """Add tempest roles overcloud + + :returns: None + :rtype: None + """ keystone_session = openstack_utils.get_overcloud_keystone_session() keystone_client = openstack_utils.get_keystone_session_client( keystone_session) @@ -238,4 +353,3 @@ def add_tempest_roles(): keystone_client.roles.create(role_name) except keystoneauth1.exceptions.http.Conflict: pass - diff --git a/zaza/openstack/charm_tests/tempest/templates/__init__.py b/zaza/openstack/charm_tests/tempest/templates/__init__.py index 1400887..9269e37 100644 --- a/zaza/openstack/charm_tests/tempest/templates/__init__.py +++ b/zaza/openstack/charm_tests/tempest/templates/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2018 Canonical Ltd. +# Copyright 2020 Canonical Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/zaza/openstack/charm_tests/tempest/tests.py b/zaza/openstack/charm_tests/tempest/tests.py index dfdc247..6fc58d7 100644 --- a/zaza/openstack/charm_tests/tempest/tests.py +++ b/zaza/openstack/charm_tests/tempest/tests.py @@ -1,3 +1,19 @@ +# Copyright 2020 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. + +"""Code for running tempest tests.""" + import os import subprocess @@ -7,13 +23,19 @@ import zaza.charm_lifecycle.test import tempest.cmd.main import tempfile - - class TempestTest(): - - test_runner = zaza.charm_lifecycle.test.DIRECT + """Tempest test class.""" def run(self): + """Run tempest tests as specified in tests/tests.yaml + + Test keys are parsed from ['tests_options']['tempest']['model'], where + valid test keys are: smoke (bool), whitelist (list of tests), blacklist + (list of tests), and regex (list of regex's). + + :returns: Status of tempest run + :rtype: bool + """ charm_config = zaza.charm_lifecycle.utils.get_charm_config() tempest_options = ['tempest', 'run', '--workspace', 'tempest-workspace', '--config', 'tempest-workspace/etc/tempest.conf'] From 9336e3efa74b65ffe3cbfd8b96b0b9984d8f0fb4 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Mon, 18 May 2020 20:07:31 +0000 Subject: [PATCH 32/52] Minor update --- zaza/openstack/charm_tests/tempest/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 59b3b8b..e36b026 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Code for configuring tempest.""" +"""Code for configuring and initializing tempest.""" import urllib.parse import os From f668784f410f0d606cfa24e04057460c67f03862 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Mon, 18 May 2020 20:09:37 +0000 Subject: [PATCH 33/52] Add the missing test_runner --- zaza/openstack/charm_tests/tempest/tests.py | 1 + 1 file changed, 1 insertion(+) diff --git a/zaza/openstack/charm_tests/tempest/tests.py b/zaza/openstack/charm_tests/tempest/tests.py index 6fc58d7..bbc9d9e 100644 --- a/zaza/openstack/charm_tests/tempest/tests.py +++ b/zaza/openstack/charm_tests/tempest/tests.py @@ -25,6 +25,7 @@ import tempfile class TempestTest(): """Tempest test class.""" + test_runner = zaza.charm_lifecycle.test.DIRECT def run(self): """Run tempest tests as specified in tests/tests.yaml From db47aa1fb9fa627481bcd14e8cc947a6eadfe267 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Mon, 18 May 2020 20:10:52 +0000 Subject: [PATCH 34/52] Minor update --- zaza/openstack/charm_tests/tempest/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zaza/openstack/charm_tests/tempest/__init__.py b/zaza/openstack/charm_tests/tempest/__init__.py index 9703646..cf4c994 100644 --- a/zaza/openstack/charm_tests/tempest/__init__.py +++ b/zaza/openstack/charm_tests/tempest/__init__.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Collection of code for setting up and using tempest.""" +"""Collection of code for setting up and running tempest.""" From 5075e97470677c450c2e044493596c03bb55ac94 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Wed, 20 May 2020 18:13:48 +0000 Subject: [PATCH 35/52] Switch Member -> member --- zaza/openstack/charm_tests/tempest/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index e36b026..4f25686 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -348,7 +348,7 @@ def add_tempest_roles(): keystone_session = openstack_utils.get_overcloud_keystone_session() keystone_client = openstack_utils.get_keystone_session_client( keystone_session) - for role_name in ['Member', 'ResellerAdmin']: + for role_name in ['member', 'ResellerAdmin']: try: keystone_client.roles.create(role_name) except keystoneauth1.exceptions.http.Conflict: From 19725c73b54f86440d8bbf8a5b8ea329ad7540fd Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Wed, 20 May 2020 19:48:04 +0000 Subject: [PATCH 36/52] Fix template variable in render_tempest_config --- zaza/openstack/charm_tests/tempest/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 4f25686..5dd833e 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -249,7 +249,7 @@ def render_tempest_config(target_file, ctxt, template): """ # TODO: switch to jinja2 and generate config based on available services with open(target_file, 'w') as f: - f.write(tempest_template.file_contents.format(**ctxt)) + f.write(template.file_contents.format(**ctxt)) def setup_tempest(tempest_template, accounts_template): From c98aa001f997d2cc149e0c64e81f0339a83adc50 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Fri, 22 May 2020 19:43:10 +0000 Subject: [PATCH 37/52] Adjust basic_setup to run upgrade for < ocata --- zaza/openstack/charm_tests/ceilometer/setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zaza/openstack/charm_tests/ceilometer/setup.py b/zaza/openstack/charm_tests/ceilometer/setup.py index c966077..0ff1fb5 100644 --- a/zaza/openstack/charm_tests/ceilometer/setup.py +++ b/zaza/openstack/charm_tests/ceilometer/setup.py @@ -28,11 +28,11 @@ def basic_setup(): tests. """ current_release = openstack_utils.get_os_release() - xenial_pike = openstack_utils.get_os_release('xenial_pike') + xenial_ocata = openstack_utils.get_os_release('xenial_ocata') - if current_release < xenial_pike: + if current_release < xenial_ocata: logging.info( - 'Skipping ceilometer-upgrade as it is not supported before Pike') + 'Skipping ceilometer-upgrade as it is not supported before ocata') return logging.debug('Checking ceilometer-upgrade') From 30b7b91904f3195d10ae138a1072b8eb376fd21e Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Wed, 27 May 2020 13:50:43 +0000 Subject: [PATCH 38/52] Set api_extensions and floating_network_name api_extensions and floating_network_name are set in tempest.conf to fix tempest failures for: * test_list_show_extensions (missing 'l3_agent_scheduler' extension) * test_server_basic_ops (404 'Floating IP pool not found') --- zaza/openstack/charm_tests/tempest/setup.py | 23 +++++++++++++++++++ .../tempest/templates/tempest_v3.py | 2 ++ 2 files changed, 25 insertions(+) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 5dd833e..7f97014 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -106,6 +106,8 @@ def add_neutron_config(ctxt, keystone_session): :returns: None :rtype: None """ + current_release = openstack_utils.get_os_release() + focal_ussuri = openstack_utils.get_os_release('focal_ussuri') neutron_client = openstack_utils.get_neutron_session_client( keystone_session) for net in neutron_client.list_networks()['networks']: @@ -116,6 +118,27 @@ def add_neutron_config(ctxt, keystone_session): if router['name'] == 'provider-router': ctxt['provider_router_id'] = router['id'] break + # For focal+ with OVN, we use the same settings as upstream gate. + # This is because the l3_agent_scheduler extension is only + # applicable for OVN when conventional layer-3 agent enabled: + # https://docs.openstack.org/networking-ovn/2.0.1/features.html + # This enables test_list_show_extensions to run successfully. + if current_release >= focal_ussuri: + extensions = ('address-scope,agent,allowed-address-pairs,' + 'auto-allocated-topology,availability_zone,' + 'binding,default-subnetpools,external-net,' + 'extra_dhcp_opt,multi-provider,net-mtu,' + 'network_availability_zone,network-ip-availability,' + 'port-security,provider,quotas,rbac-address-scope,' + 'rbac-policies,standard-attr-revisions,security-group,' + 'standard-attr-description,subnet_allocation,' + 'standard-attr-tag,standard-attr-timestamp,trunk,' + 'quota_details,router,extraroute,ext-gw-mode,' + 'fip-port-details,pagination,sorting,project-id,' + 'dns-integration,qos') + ctxt['neutron_api_extensions'] = extensions + else: + ctxt['neutron_api_extensions'] = 'all' def add_glance_config(ctxt, keystone_session): diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py index f189ad5..7c95e3e 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py @@ -52,9 +52,11 @@ project_network_cidr = {os_test_cidr_priv} public_network_id = {ext_net} dns_servers = {os_test_nameserver} project_networks_reachable = false +floating_network_name = {ext_net} [network-feature-enabled] ipv6 = false +api_extensions = {neutron_api_extensions} [orchestration] stack_owner_role = Admin From e7da28abc93803c00f1954ee45758887114b29e4 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Wed, 27 May 2020 21:19:35 +0000 Subject: [PATCH 39/52] Revert "Set api_extensions and floating_network_name" This reverts commit 1cc280292963ee70aeff9f9dbb96f457f398999f. --- zaza/openstack/charm_tests/tempest/setup.py | 23 ------------------- .../tempest/templates/tempest_v3.py | 2 -- 2 files changed, 25 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 7f97014..5dd833e 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -106,8 +106,6 @@ def add_neutron_config(ctxt, keystone_session): :returns: None :rtype: None """ - current_release = openstack_utils.get_os_release() - focal_ussuri = openstack_utils.get_os_release('focal_ussuri') neutron_client = openstack_utils.get_neutron_session_client( keystone_session) for net in neutron_client.list_networks()['networks']: @@ -118,27 +116,6 @@ def add_neutron_config(ctxt, keystone_session): if router['name'] == 'provider-router': ctxt['provider_router_id'] = router['id'] break - # For focal+ with OVN, we use the same settings as upstream gate. - # This is because the l3_agent_scheduler extension is only - # applicable for OVN when conventional layer-3 agent enabled: - # https://docs.openstack.org/networking-ovn/2.0.1/features.html - # This enables test_list_show_extensions to run successfully. - if current_release >= focal_ussuri: - extensions = ('address-scope,agent,allowed-address-pairs,' - 'auto-allocated-topology,availability_zone,' - 'binding,default-subnetpools,external-net,' - 'extra_dhcp_opt,multi-provider,net-mtu,' - 'network_availability_zone,network-ip-availability,' - 'port-security,provider,quotas,rbac-address-scope,' - 'rbac-policies,standard-attr-revisions,security-group,' - 'standard-attr-description,subnet_allocation,' - 'standard-attr-tag,standard-attr-timestamp,trunk,' - 'quota_details,router,extraroute,ext-gw-mode,' - 'fip-port-details,pagination,sorting,project-id,' - 'dns-integration,qos') - ctxt['neutron_api_extensions'] = extensions - else: - ctxt['neutron_api_extensions'] = 'all' def add_glance_config(ctxt, keystone_session): diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py index 7c95e3e..f189ad5 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py @@ -52,11 +52,9 @@ project_network_cidr = {os_test_cidr_priv} public_network_id = {ext_net} dns_servers = {os_test_nameserver} project_networks_reachable = false -floating_network_name = {ext_net} [network-feature-enabled] ipv6 = false -api_extensions = {neutron_api_extensions} [orchestration] stack_owner_role = Admin From 924da664cff843e159dcd4091986d00f6ad2ae90 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Thu, 28 May 2020 01:29:14 +0000 Subject: [PATCH 40/52] Revert "Revert "Set api_extensions and floating_network_name"" This reverts commit 21ee604329552faacfe7984180eb34e003d0cc1b. --- zaza/openstack/charm_tests/tempest/setup.py | 23 +++++++++++++++++++ .../tempest/templates/tempest_v3.py | 2 ++ 2 files changed, 25 insertions(+) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 5dd833e..7f97014 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -106,6 +106,8 @@ def add_neutron_config(ctxt, keystone_session): :returns: None :rtype: None """ + current_release = openstack_utils.get_os_release() + focal_ussuri = openstack_utils.get_os_release('focal_ussuri') neutron_client = openstack_utils.get_neutron_session_client( keystone_session) for net in neutron_client.list_networks()['networks']: @@ -116,6 +118,27 @@ def add_neutron_config(ctxt, keystone_session): if router['name'] == 'provider-router': ctxt['provider_router_id'] = router['id'] break + # For focal+ with OVN, we use the same settings as upstream gate. + # This is because the l3_agent_scheduler extension is only + # applicable for OVN when conventional layer-3 agent enabled: + # https://docs.openstack.org/networking-ovn/2.0.1/features.html + # This enables test_list_show_extensions to run successfully. + if current_release >= focal_ussuri: + extensions = ('address-scope,agent,allowed-address-pairs,' + 'auto-allocated-topology,availability_zone,' + 'binding,default-subnetpools,external-net,' + 'extra_dhcp_opt,multi-provider,net-mtu,' + 'network_availability_zone,network-ip-availability,' + 'port-security,provider,quotas,rbac-address-scope,' + 'rbac-policies,standard-attr-revisions,security-group,' + 'standard-attr-description,subnet_allocation,' + 'standard-attr-tag,standard-attr-timestamp,trunk,' + 'quota_details,router,extraroute,ext-gw-mode,' + 'fip-port-details,pagination,sorting,project-id,' + 'dns-integration,qos') + ctxt['neutron_api_extensions'] = extensions + else: + ctxt['neutron_api_extensions'] = 'all' def add_glance_config(ctxt, keystone_session): diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py index f189ad5..7c95e3e 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py @@ -52,9 +52,11 @@ project_network_cidr = {os_test_cidr_priv} public_network_id = {ext_net} dns_servers = {os_test_nameserver} project_networks_reachable = false +floating_network_name = {ext_net} [network-feature-enabled] ipv6 = false +api_extensions = {neutron_api_extensions} [orchestration] stack_owner_role = Admin From 35a9e55ea543bda3b26ac5193e168fe18d74dc58 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Thu, 28 May 2020 14:19:04 +0000 Subject: [PATCH 41/52] Fix pep8 issues --- zaza/openstack/charm_tests/tempest/setup.py | 42 +++++++++---------- .../charm_tests/tempest/templates/accounts.py | 1 + .../tempest/templates/tempest_v2.py | 1 + .../tempest/templates/tempest_v3.py | 1 + zaza/openstack/charm_tests/tempest/tests.py | 10 +++-- 5 files changed, 30 insertions(+), 25 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 7f97014..9f442bc 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -16,7 +16,6 @@ import urllib.parse import os -import shutil import subprocess import zaza.model @@ -44,7 +43,7 @@ TEMPEST_CIRROS_ALT_IMAGE_NAME = 'cirros_alt' def get_app_access_ip(application_name): - """Get the application's access IP + """Get the application's access IP. :param application_name: Name of application :type application_name: str @@ -65,7 +64,7 @@ def get_app_access_ip(application_name): def add_application_ips(ctxt): - """Add application access IPs to context + """Add application access IPs to context. :param ctxt: Context dictionary :type ctxt: dict @@ -78,7 +77,7 @@ def add_application_ips(ctxt): def add_nova_config(ctxt, keystone_session): - """Add nova config to context + """Add nova config to context. :param ctxt: Context dictionary :type ctxt: dict @@ -97,7 +96,7 @@ def add_nova_config(ctxt, keystone_session): def add_neutron_config(ctxt, keystone_session): - """Add neutron config to context + """Add neutron config to context. :param ctxt: Context dictionary :type ctxt: dict @@ -142,7 +141,7 @@ def add_neutron_config(ctxt, keystone_session): def add_glance_config(ctxt, keystone_session): - """Add glance config to context + """Add glance config to context. :param ctxt: Context dictionary :type ctxt: dict @@ -164,7 +163,7 @@ def add_glance_config(ctxt, keystone_session): def add_cinder_config(ctxt, keystone_session): - """Add cinder config to context + """Add cinder config to context. :param ctxt: Context dictionary :type ctxt: dict @@ -184,7 +183,7 @@ def add_cinder_config(ctxt, keystone_session): def add_keystone_config(ctxt, keystone_session): - """Add keystone config to context + """Add keystone config to context. :param ctxt: Context dictionary :type ctxt: dict @@ -202,7 +201,7 @@ def add_keystone_config(ctxt, keystone_session): def add_environment_var_config(ctxt): - """Add environment variable config to context + """Add environment variable config to context. :param ctxt: Context dictionary :type ctxt: dict @@ -221,7 +220,7 @@ def add_environment_var_config(ctxt): def add_auth_config(ctxt): - """Add authorization config to context + """Add authorization config to context. :param ctxt: Context dictionary :type ctxt: dict @@ -235,12 +234,12 @@ def add_auth_config(ctxt): if overcloud_auth['API_VERSION'] == 3: ctxt['admin_project_name'] = overcloud_auth['OS_PROJECT_NAME'] ctxt['admin_domain_name'] = overcloud_auth['OS_DOMAIN_NAME'] - ctxt['default_credentials_domain_name'] = overcloud_auth[ - 'OS_PROJECT_DOMAIN_NAME'] + ctxt['default_credentials_domain_name'] = ( + overcloud_auth['OS_PROJECT_DOMAIN_NAME']) def get_tempest_context(): - """Generate the tempest config context + """Generate the tempest config context. :returns: Context dictionary :rtype: dict @@ -259,7 +258,7 @@ def get_tempest_context(): def render_tempest_config(target_file, ctxt, template): - """Render tempest config for specified config file and template + """Render tempest config for specified config file and template. :param target_file: Name of file to render config to :type target_file: str @@ -276,7 +275,7 @@ def render_tempest_config(target_file, ctxt, template): def setup_tempest(tempest_template, accounts_template): - """Initialize tempest and render tempest config + """Initialize tempest and render tempest config. :param tempest_template: tempest.conf template :type tempest_template: module @@ -287,7 +286,8 @@ def setup_tempest(tempest_template, accounts_template): """ if os.path.isdir('tempest-workspace'): try: - subprocess.check_call(['tempest', 'workspace', 'remove', '--rmdir', '--name', 'tempest-workspace']) + subprocess.check_call(['tempest', 'workspace', 'remove', '--rmdir', + '--name', 'tempest-workspace']) except subprocess.CalledProcessError: pass try: @@ -305,7 +305,7 @@ def setup_tempest(tempest_template, accounts_template): def render_tempest_config_keystone_v2(): - """Render tempest config for Keystone V2 API + """Render tempest config for Keystone V2 API. :returns: None :rtype: None @@ -314,7 +314,7 @@ def render_tempest_config_keystone_v2(): def render_tempest_config_keystone_v3(): - """Render tempest config for Keystone V3 API + """Render tempest config for Keystone V3 API. :returns: None :rtype: None @@ -323,7 +323,7 @@ def render_tempest_config_keystone_v3(): def add_cirros_alt_image(): - """Add cirros alternate image to overcloud + """Add cirros alternate image to overcloud. :returns: None :rtype: None @@ -336,7 +336,7 @@ def add_cirros_alt_image(): def add_tempest_flavors(): - """Add tempest flavors to overcloud + """Add tempest flavors to overcloud. :returns: None :rtype: None @@ -363,7 +363,7 @@ def add_tempest_flavors(): def add_tempest_roles(): - """Add tempest roles overcloud + """Add tempest roles overcloud. :returns: None :rtype: None diff --git a/zaza/openstack/charm_tests/tempest/templates/accounts.py b/zaza/openstack/charm_tests/tempest/templates/accounts.py index 3e5329d..0c5cf5a 100644 --- a/zaza/openstack/charm_tests/tempest/templates/accounts.py +++ b/zaza/openstack/charm_tests/tempest/templates/accounts.py @@ -1,3 +1,4 @@ +# flake8: noqa file_contents = """ - username: 'demo' tenant_name: 'demo' diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py index ecca5ce..c5649d0 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py @@ -1,3 +1,4 @@ +# flake8: noqa file_contents = """ [DEFAULT] debug = false diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py index 7c95e3e..4f183dd 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py @@ -1,3 +1,4 @@ +# flake8: noqa file_contents = """ [DEFAULT] debug = false diff --git a/zaza/openstack/charm_tests/tempest/tests.py b/zaza/openstack/charm_tests/tempest/tests.py index bbc9d9e..d726930 100644 --- a/zaza/openstack/charm_tests/tempest/tests.py +++ b/zaza/openstack/charm_tests/tempest/tests.py @@ -20,15 +20,16 @@ import subprocess import zaza import zaza.charm_lifecycle.utils import zaza.charm_lifecycle.test -import tempest.cmd.main import tempfile + class TempestTest(): """Tempest test class.""" + test_runner = zaza.charm_lifecycle.test.DIRECT def run(self): - """Run tempest tests as specified in tests/tests.yaml + """Run tempest tests as specified in tests/tests.yaml. Test keys are parsed from ['tests_options']['tempest']['model'], where valid test keys are: smoke (bool), whitelist (list of tests), blacklist @@ -38,8 +39,9 @@ class TempestTest(): :rtype: bool """ charm_config = zaza.charm_lifecycle.utils.get_charm_config() - tempest_options = ['tempest', 'run', '--workspace', 'tempest-workspace', - '--config', 'tempest-workspace/etc/tempest.conf'] + tempest_options = ['tempest', 'run', '--workspace', + 'tempest-workspace', '--config', + 'tempest-workspace/etc/tempest.conf'] for model_alias in zaza.model.get_juju_model_aliases().keys(): tempest_test_key = model_alias if model_alias == zaza.charm_lifecycle.utils.DEFAULT_MODEL_ALIAS: From 820667011db87f4b0282dd55bf25095036484e9e Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Thu, 28 May 2020 15:23:54 +0000 Subject: [PATCH 42/52] Add initial tempest branches to requirements.txt --- requirements.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/requirements.txt b/requirements.txt index e43c4e5..1446e9d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -40,3 +40,7 @@ paramiko sphinx sphinxcontrib-asyncio git+https://github.com/openstack-charmers/zaza#egg=zaza + +# Tempest tests +git+https://opendev.org/openstack/tempest.git#egg=tempest +git+https://opendev.org/openstack/cinder-tempest-plugin.git#egg=cinder-tempest-plugin From d84622d088bf3f17302a3f1c292fc3eb27a3efc4 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Fri, 29 May 2020 16:52:16 +0000 Subject: [PATCH 43/52] Drop tempest from requirements.txt as it doesn't support py35 --- requirements.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index 1446e9d..e43c4e5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -40,7 +40,3 @@ paramiko sphinx sphinxcontrib-asyncio git+https://github.com/openstack-charmers/zaza#egg=zaza - -# Tempest tests -git+https://opendev.org/openstack/tempest.git#egg=tempest -git+https://opendev.org/openstack/cinder-tempest-plugin.git#egg=cinder-tempest-plugin From 46d9887b45a63468f1aaf7e752d1c25ef5ee3dcb Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Fri, 5 Jun 2020 14:35:29 +0000 Subject: [PATCH 44/52] Move get_application_ip to zaza/openstack/utilities/juju.py --- zaza/openstack/charm_tests/tempest/setup.py | 28 +++------------------ zaza/openstack/utilities/juju.py | 21 ++++++++++++++++ 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 9f442bc..f8772ea 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -20,6 +20,7 @@ import subprocess import zaza.model import zaza.utilities.deployment_env as deployment_env +import zaza.openstack.utilities.juju as juju_utils import zaza.openstack.utilities.openstack as openstack_utils import zaza.openstack.charm_tests.glance.setup as glance_setup import zaza.openstack.charm_tests.tempest.templates.tempest_v2 as tempest_v2 @@ -42,27 +43,6 @@ TEMPEST_ALT_FLAVOR_NAME = 'm2.tempest' TEMPEST_CIRROS_ALT_IMAGE_NAME = 'cirros_alt' -def get_app_access_ip(application_name): - """Get the application's access IP. - - :param application_name: Name of application - :type application_name: str - :returns: Application's access IP - :rtype: str - """ - try: - app_config = zaza.model.get_application_config(application_name) - except KeyError: - return '' - vip = app_config.get("vip").get("value") - if vip: - ip = vip - else: - unit = zaza.model.get_units(application_name)[0] - ip = unit.public_address - return ip - - def add_application_ips(ctxt): """Add application access IPs to context. @@ -71,9 +51,9 @@ def add_application_ips(ctxt): :returns: None :rtype: None """ - ctxt['keystone'] = get_app_access_ip('keystone') - ctxt['dashboard'] = get_app_access_ip('openstack-dashboard') - ctxt['ncc'] = get_app_access_ip('nova-cloud-controller') + ctxt['keystone'] = juju_utils.get_application_ip('keystone') + ctxt['dashboard'] = juju_utils.get_application_ip('openstack-dashboard') + ctxt['ncc'] = juju_utils.get_application_ip('nova-cloud-controller') def add_nova_config(ctxt, keystone_session): diff --git a/zaza/openstack/utilities/juju.py b/zaza/openstack/utilities/juju.py index b3e54bc..191bc99 100644 --- a/zaza/openstack/utilities/juju.py +++ b/zaza/openstack/utilities/juju.py @@ -49,6 +49,27 @@ def get_application_status(application=None, unit=None, model_name=None): return status +def get_application_ip(application): + """Get the application's IP address. + + :param application: Application name + :type application: str + :returns: Application's IP address + :rtype: str + """ + try: + app_config = model.get_application_config(application) + except KeyError: + return '' + vip = app_config.get("vip").get("value") + if vip: + ip = vip + else: + unit = zaza.model.get_units(application_name)[0] + ip = unit.public_address + return ip + + def get_cloud_configs(cloud=None): """Get cloud configuration from local clouds.yaml. From 616f04f0bc8f67b1a744e3f8881a1fc3c88a9e97 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Fri, 5 Jun 2020 14:54:26 +0000 Subject: [PATCH 45/52] Move add_cirros_alt_image to glance setup.py and fix up loops --- zaza/openstack/charm_tests/glance/setup.py | 13 ++++++++ zaza/openstack/charm_tests/tempest/setup.py | 34 +++++---------------- 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/zaza/openstack/charm_tests/glance/setup.py b/zaza/openstack/charm_tests/glance/setup.py index c992917..8c7bd3e 100644 --- a/zaza/openstack/charm_tests/glance/setup.py +++ b/zaza/openstack/charm_tests/glance/setup.py @@ -18,6 +18,7 @@ import logging import zaza.openstack.utilities.openstack as openstack_utils CIRROS_IMAGE_NAME = "cirros" +CIRROS_ALT_IMAGE_NAME = "cirros_alt" LTS_RELEASE = "bionic" LTS_IMAGE_NAME = "bionic" @@ -77,6 +78,18 @@ def add_cirros_image(glance_client=None, image_name=None): image_name=image_name) +def add_cirros_alt_image(glance_client=None, image_name=None): + """Add alt cirros image to the current deployment. + + :param glance: Authenticated glanceclient + :type glance: glanceclient.Client + :param image_name: Label for the image in glance + :type image_name: str + """ + image_name = image_name or CIRROS_ALT_IMAGE_NAME + add_cirros_image(glance_client, image_name) + + def add_lts_image(glance_client=None, image_name=None, release=None): """Add an Ubuntu LTS image to the current deployment. diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index f8772ea..0e90597 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -40,7 +40,6 @@ SETUP_ENV_VARS = [ ] TEMPEST_FLAVOR_NAME = 'm1.tempest' TEMPEST_ALT_FLAVOR_NAME = 'm2.tempest' -TEMPEST_CIRROS_ALT_IMAGE_NAME = 'cirros_alt' def add_application_ips(ctxt): @@ -89,14 +88,10 @@ def add_neutron_config(ctxt, keystone_session): focal_ussuri = openstack_utils.get_os_release('focal_ussuri') neutron_client = openstack_utils.get_neutron_session_client( keystone_session) - for net in neutron_client.list_networks()['networks']: - if net['name'] == 'ext_net': - ctxt['ext_net'] = net['id'] - break - for router in neutron_client.list_routers()['routers']: - if router['name'] == 'provider-router': - ctxt['provider_router_id'] = router['id'] - break + net = neutron_client.find_resource("network", "ext_net") + ctxt['ext_net'] = net['id'] + router = neutron_client.find_resource("router", "provider-router") + ctxt['provider_router_id'] = router['id'] # For focal+ with OVN, we use the same settings as upstream gate. # This is because the l3_agent_scheduler extension is only # applicable for OVN when conventional layer-3 agent enabled: @@ -135,7 +130,7 @@ def add_glance_config(ctxt, keystone_session): image = openstack_utils.get_images_by_name( glance_client, glance_setup.CIRROS_IMAGE_NAME) image_alt = openstack_utils.get_images_by_name( - glance_client, TEMPEST_CIRROS_ALT_IMAGE_NAME) + glance_client, glance_setup.CIRROS_ALT_IMAGE_NAME) if image: ctxt['image_id'] = image[0].id if image_alt: @@ -174,10 +169,8 @@ def add_keystone_config(ctxt, keystone_session): """ keystone_client = openstack_utils.get_keystone_session_client( keystone_session) - for domain in keystone_client.domains.list(): - if domain.name == 'admin_domain': - ctxt['default_domain_id'] = domain.id - break + domain = keystone_client.domains.find(name="admin_domain") + ctxt['default_domain_id'] = domain.id def add_environment_var_config(ctxt): @@ -302,19 +295,6 @@ def render_tempest_config_keystone_v3(): setup_tempest(tempest_v3, accounts) -def add_cirros_alt_image(): - """Add cirros alternate image to overcloud. - - :returns: None - :rtype: None - """ - image_url = openstack_utils.find_cirros_image(arch='x86_64') - glance_setup.add_image( - image_url, - glance_client=None, - image_name=TEMPEST_CIRROS_ALT_IMAGE_NAME) - - def add_tempest_flavors(): """Add tempest flavors to overcloud. From 3837b1ac85f4852c5314ab23e0180725a3e22c96 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Fri, 5 Jun 2020 15:54:33 +0000 Subject: [PATCH 46/52] Drop add_tempest_flavors in favor of using nova.setup.create_flavors --- zaza/openstack/charm_tests/nova/utils.py | 10 ++++++++ zaza/openstack/charm_tests/tempest/setup.py | 27 --------------------- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/zaza/openstack/charm_tests/nova/utils.py b/zaza/openstack/charm_tests/nova/utils.py index 974edd7..f2fcefc 100644 --- a/zaza/openstack/charm_tests/nova/utils.py +++ b/zaza/openstack/charm_tests/nova/utils.py @@ -35,5 +35,15 @@ FLAVORS = { 'ram': 8192, 'disk': 40, 'vcpus': 4}, + 'm1.tempest': { + 'flavorid': 5, + 'ram': 256, + 'disk': 1, + 'vcpus': 1}, + 'm2.tempest': { + 'flavorid': 6, + 'ram': 512, + 'disk': 1, + 'vcpus': 1}, } KEYPAIR_NAME = 'zaza' diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 0e90597..f93b3d3 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -295,33 +295,6 @@ def render_tempest_config_keystone_v3(): setup_tempest(tempest_v3, accounts) -def add_tempest_flavors(): - """Add tempest flavors to overcloud. - - :returns: None - :rtype: None - """ - keystone_session = openstack_utils.get_overcloud_keystone_session() - nova_client = openstack_utils.get_nova_session_client( - keystone_session) - try: - nova_client.flavors.create( - name=TEMPEST_FLAVOR_NAME, - ram=256, - vcpus=1, - disk=1) - except novaclient.exceptions.Conflict: - pass - try: - nova_client.flavors.create( - name=TEMPEST_ALT_FLAVOR_NAME, - ram=512, - vcpus=1, - disk=1) - except novaclient.exceptions.Conflict: - pass - - def add_tempest_roles(): """Add tempest roles overcloud. From 4e993e425167078a7fea63368b8a487440316c12 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Fri, 5 Jun 2020 17:56:10 +0000 Subject: [PATCH 47/52] Move add_tempest_roles to keystone setup.py --- .../charm_tests/keystone/__init__.py | 2 ++ zaza/openstack/charm_tests/keystone/setup.py | 30 +++++++++++++++++++ zaza/openstack/charm_tests/tempest/setup.py | 29 ++++-------------- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/zaza/openstack/charm_tests/keystone/__init__.py b/zaza/openstack/charm_tests/keystone/__init__.py index 6c4cca6..4d2e829 100644 --- a/zaza/openstack/charm_tests/keystone/__init__.py +++ b/zaza/openstack/charm_tests/keystone/__init__.py @@ -26,6 +26,8 @@ DEMO_ADMIN_USER_PASSWORD = 'password' DEMO_USER = 'demo' DEMO_PASSWORD = 'password' +TEMPEST_ROLES = ['member', 'ResellerAdmin'] + class BaseKeystoneTest(test_utils.OpenStackBaseTest): """Base for Keystone charm tests.""" diff --git a/zaza/openstack/charm_tests/keystone/setup.py b/zaza/openstack/charm_tests/keystone/setup.py index 688e3cd..6dbb7c1 100644 --- a/zaza/openstack/charm_tests/keystone/setup.py +++ b/zaza/openstack/charm_tests/keystone/setup.py @@ -14,6 +14,8 @@ """Code for setting up keystone.""" +import keystoneauth1 + import zaza.openstack.utilities.openstack as openstack_utils from zaza.openstack.charm_tests.keystone import ( BaseKeystoneTest, @@ -24,6 +26,7 @@ from zaza.openstack.charm_tests.keystone import ( DEMO_ADMIN_USER_PASSWORD, DEMO_USER, DEMO_PASSWORD, + TEMPEST_ROLES, ) @@ -115,3 +118,30 @@ def add_demo_user(): else: # create only V3 user _v3() + + +def _add_additional_roles(roles): + """Add additional roles to this deployment. + + :param ctxt: roles + :type ctxt: list + :returns: None + :rtype: None + """ + keystone_session = openstack_utils.get_overcloud_keystone_session() + keystone_client = openstack_utils.get_keystone_session_client( + keystone_session) + for role_name in roles: + try: + keystone_client.roles.create(role_name) + except keystoneauth1.exceptions.http.Conflict: + pass + + +def add_tempest_roles(): + """Add tempest roles to this deployment. + + :returns: None + :rtype: None + """ + _add_additional_roles(TEMPEST_ROLES) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index f93b3d3..1b5b4de 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -27,9 +27,6 @@ import zaza.openstack.charm_tests.tempest.templates.tempest_v2 as tempest_v2 import zaza.openstack.charm_tests.tempest.templates.tempest_v3 as tempest_v3 import zaza.openstack.charm_tests.tempest.templates.accounts as accounts -import keystoneauth1 -import novaclient - SETUP_ENV_VARS = [ 'OS_TEST_GATEWAY', 'OS_TEST_CIDR_EXT', @@ -60,7 +57,7 @@ def add_nova_config(ctxt, keystone_session): :param ctxt: Context dictionary :type ctxt: dict - :returns keystone_session: keystoneauth1.session.Session object + :param keystone_session: keystoneauth1.session.Session object :type: keystoneauth1.session.Session :returns: None :rtype: None @@ -79,7 +76,7 @@ def add_neutron_config(ctxt, keystone_session): :param ctxt: Context dictionary :type ctxt: dict - :returns keystone_session: keystoneauth1.session.Session object + :param keystone_session: keystoneauth1.session.Session object :type: keystoneauth1.session.Session :returns: None :rtype: None @@ -120,7 +117,7 @@ def add_glance_config(ctxt, keystone_session): :param ctxt: Context dictionary :type ctxt: dict - :returns keystone_session: keystoneauth1.session.Session object + :param keystone_session: keystoneauth1.session.Session object :type: keystoneauth1.session.Session :returns: None :rtype: None @@ -142,7 +139,7 @@ def add_cinder_config(ctxt, keystone_session): :param ctxt: Context dictionary :type ctxt: dict - :returns keystone_session: keystoneauth1.session.Session object + :param keystone_session: keystoneauth1.session.Session object :type: keystoneauth1.session.Session :returns: None :rtype: None @@ -162,7 +159,7 @@ def add_keystone_config(ctxt, keystone_session): :param ctxt: Context dictionary :type ctxt: dict - :returns keystone_session: keystoneauth1.session.Session object + :param keystone_session: keystoneauth1.session.Session object :type: keystoneauth1.session.Session :returns: None :rtype: None @@ -293,19 +290,3 @@ def render_tempest_config_keystone_v3(): :rtype: None """ setup_tempest(tempest_v3, accounts) - - -def add_tempest_roles(): - """Add tempest roles overcloud. - - :returns: None - :rtype: None - """ - keystone_session = openstack_utils.get_overcloud_keystone_session() - keystone_client = openstack_utils.get_keystone_session_client( - keystone_session) - for role_name in ['member', 'ResellerAdmin']: - try: - keystone_client.roles.create(role_name) - except keystoneauth1.exceptions.http.Conflict: - pass From 7d0dfadc80016f31ac156c459e1bd85577c2bc31 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Fri, 5 Jun 2020 20:02:45 +0000 Subject: [PATCH 48/52] Fix incorrect reference to model --- zaza/openstack/utilities/juju.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zaza/openstack/utilities/juju.py b/zaza/openstack/utilities/juju.py index 191bc99..069801d 100644 --- a/zaza/openstack/utilities/juju.py +++ b/zaza/openstack/utilities/juju.py @@ -65,7 +65,7 @@ def get_application_ip(application): if vip: ip = vip else: - unit = zaza.model.get_units(application_name)[0] + unit = model.get_units(application_name)[0] ip = unit.public_address return ip From 5401be3a9700782d84bef0f78cdd3ccc06d6378a Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Fri, 5 Jun 2020 20:04:51 +0000 Subject: [PATCH 49/52] Fix variable name --- zaza/openstack/utilities/juju.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zaza/openstack/utilities/juju.py b/zaza/openstack/utilities/juju.py index 069801d..3bdf4b8 100644 --- a/zaza/openstack/utilities/juju.py +++ b/zaza/openstack/utilities/juju.py @@ -65,7 +65,7 @@ def get_application_ip(application): if vip: ip = vip else: - unit = model.get_units(application_name)[0] + unit = model.get_units(application)[0] ip = unit.public_address return ip From 5d59fa43a5907eb5d939f05f43d0196b75905778 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Fri, 5 Jun 2020 22:55:24 +0000 Subject: [PATCH 50/52] Update flavor ids --- zaza/openstack/charm_tests/nova/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zaza/openstack/charm_tests/nova/utils.py b/zaza/openstack/charm_tests/nova/utils.py index f2fcefc..b16eef4 100644 --- a/zaza/openstack/charm_tests/nova/utils.py +++ b/zaza/openstack/charm_tests/nova/utils.py @@ -36,12 +36,12 @@ FLAVORS = { 'disk': 40, 'vcpus': 4}, 'm1.tempest': { - 'flavorid': 5, + 'flavorid': 6, 'ram': 256, 'disk': 1, 'vcpus': 1}, 'm2.tempest': { - 'flavorid': 6, + 'flavorid': 7, 'ram': 512, 'disk': 1, 'vcpus': 1}, From 7f6ed4665d83bd7ff243856e999c8ba718898a29 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Tue, 9 Jun 2020 14:01:27 +0000 Subject: [PATCH 51/52] Fix pep8 error --- zaza/openstack/charm_tests/tempest/setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index 1b5b4de..e6d7295 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -18,7 +18,6 @@ import urllib.parse import os import subprocess -import zaza.model import zaza.utilities.deployment_env as deployment_env import zaza.openstack.utilities.juju as juju_utils import zaza.openstack.utilities.openstack as openstack_utils From bdc2e96e93339a2fa3ec5a292ce90288de9118b6 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Tue, 9 Jun 2020 14:22:26 +0000 Subject: [PATCH 52/52] Drop OS_ prefix from SETUP_ENV_VARS --- zaza/openstack/charm_tests/tempest/setup.py | 12 ++++++------ .../charm_tests/tempest/templates/tempest_v2.py | 6 +++--- .../charm_tests/tempest/templates/tempest_v3.py | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/setup.py b/zaza/openstack/charm_tests/tempest/setup.py index e6d7295..4266ddc 100644 --- a/zaza/openstack/charm_tests/tempest/setup.py +++ b/zaza/openstack/charm_tests/tempest/setup.py @@ -27,12 +27,12 @@ import zaza.openstack.charm_tests.tempest.templates.tempest_v3 as tempest_v3 import zaza.openstack.charm_tests.tempest.templates.accounts as accounts SETUP_ENV_VARS = [ - 'OS_TEST_GATEWAY', - 'OS_TEST_CIDR_EXT', - 'OS_TEST_FIP_RANGE', - 'OS_TEST_NAMESERVER', - 'OS_TEST_CIDR_PRIV', - 'OS_TEST_SWIFT_IP', + 'TEST_GATEWAY', + 'TEST_CIDR_EXT', + 'TEST_FIP_RANGE', + 'TEST_NAMESERVER', + 'TEST_CIDR_PRIV', + 'TEST_SWIFT_IP', ] TEMPEST_FLAVOR_NAME = 'm1.tempest' TEMPEST_ALT_FLAVOR_NAME = 'm2.tempest' diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py index c5649d0..8b0f939 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v2.py @@ -44,12 +44,12 @@ api_v2 = true api_v3 = false [image] -http_image = http://{os_test_swift_ip}:80/swift/v1/images/cirros-0.3.4-x86_64-uec.tar.gz +http_image = http://{test_swift_ip}:80/swift/v1/images/cirros-0.3.4-x86_64-uec.tar.gz [network] -project_network_cidr = {os_test_cidr_priv} +project_network_cidr = {test_cidr_priv} public_network_id = {ext_net} -dns_servers = {os_test_nameserver} +dns_servers = {test_nameserver} project_networks_reachable = false [network-feature-enabled] diff --git a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py index 4f183dd..5140deb 100644 --- a/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py +++ b/zaza/openstack/charm_tests/tempest/templates/tempest_v3.py @@ -46,12 +46,12 @@ api_v2 = false api_v3 = true [image] -http_image = http://{os_test_swift_ip}:80/swift/v1/images/cirros-0.3.4-x86_64-uec.tar.gz +http_image = http://{test_swift_ip}:80/swift/v1/images/cirros-0.3.4-x86_64-uec.tar.gz [network] -project_network_cidr = {os_test_cidr_priv} +project_network_cidr = {test_cidr_priv} public_network_id = {ext_net} -dns_servers = {os_test_nameserver} +dns_servers = {test_nameserver} project_networks_reachable = false floating_network_name = {ext_net}