From b906aee01dad700b699130557b42de4717f85a26 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Sun, 31 Jan 2016 16:03:58 -0600 Subject: [PATCH] Add in-tree tempest tests To give more flexibility for tempest test coverage, use the tempest plugin interface to add tempest tests to the Cinder repo. Just the plumbing for now. A temporary tempest test was added just for validation. This test should be removed once additional tests are added. Third party CIs should change their command line from: tox -e all -- volume To something like: tox -e all-plugin -- volume Change-Id: I679b1cee6dc9187fd2b11c47a14be9f7acdad938 Implements: blueprint add-intree-tempest-tests --- setup.cfg | 5 +- tempest_tests/README.rst | 62 +++++++++++++++++++ tempest_tests/__init__.py | 0 tempest_tests/config.py | 26 ++++++++ tempest_tests/plugin.py | 39 ++++++++++++ tempest_tests/services/__init__.py | 0 tempest_tests/tests/__init__.py | 0 tempest_tests/tests/api/__init__.py | 0 tempest_tests/tests/api/volume/__init__.py | 0 .../api/volume/test_volume_placeholder.py | 28 +++++++++ tempest_tests/tests/scenario/__init__.py | 0 11 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 tempest_tests/README.rst create mode 100644 tempest_tests/__init__.py create mode 100644 tempest_tests/config.py create mode 100644 tempest_tests/plugin.py create mode 100644 tempest_tests/services/__init__.py create mode 100644 tempest_tests/tests/__init__.py create mode 100644 tempest_tests/tests/api/__init__.py create mode 100644 tempest_tests/tests/api/volume/__init__.py create mode 100644 tempest_tests/tests/api/volume/test_volume_placeholder.py create mode 100644 tempest_tests/tests/scenario/__init__.py diff --git a/setup.cfg b/setup.cfg index ee7c01964a3..fdd93ed212d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -73,6 +73,9 @@ oslo_middleware = cinder.database.migration_backend = sqlalchemy = oslo_db.sqlalchemy.migration +# In-tree Tempest test entry point +tempest.test_plugins = + cinder_tests = tempest_tests.plugin:CinderTempestPlugin [build_sphinx] all_files = 1 @@ -80,7 +83,7 @@ build-dir = doc/build source-dir = doc/source [egg_info] -tag_build = +tag_build = tag_date = 0 tag_svn_revision = 0 diff --git a/tempest_tests/README.rst b/tempest_tests/README.rst new file mode 100644 index 00000000000..a695781d667 --- /dev/null +++ b/tempest_tests/README.rst @@ -0,0 +1,62 @@ +=============================================== +Tempest Integration for Cinder +=============================================== + +This directory contains additional Cinder tempest tests. + +See the tempest plugin docs for information on using it: +http://docs.openstack.org/developer/tempest/plugin.html#using-plugins + +To run all tests from this plugin, install cinder into your environment. Then +from the tempest directory run:: + + $ tox -e all-plugin -- volume + + +It is expected that Cinder third party CI's use the all-plugin tox environment +above for all test runs. Developers can also use this locally to perform more +extensive testing. + +Any typical devstack instance should be able to run all Cinder plugin tests. +For completeness, here is an example of a devstack local.conf that should +work. Update backend information to fit your environment. + +:: + + [[local|localrc]] + VIRT_DRIVER=libvirt + ADMIN_PASSWORD=secret + SERVICE_TOKEN=$ADMIN_PASSWORD + MYSQL_PASSWORD=$ADMIN_PASSWORD + RABBIT_PASSWORD=$ADMIN_PASSWORD + SERVICE_PASSWORD=$ADMIN_PASSWORD + SCREEN_LOGDIR=/opt/stack/screen-logs + LOGFILE=$DEST/logs/stack.sh.log + LOGDAYS=2 + SYSLOG=False + LOG_COLOR=False + RECLONE=yes + ENABLED_SERVICES=c-api,c-sch,c-vol,cinder,dstat,g-api,g-reg,key,mysql, + n-api,n-cond,n-cpu,n-crt,n-net,n-sch,rabbit,tempest + CINDER_ENABLED_BACKENDS=lvmdriver-1 + CINDER_DEFAULT_VOLUME_TYPE=lvmdriver-1 + CINDER_SECURE_DELETE=False + TEMPEST_ENABLED_BACKENDS=lvmdriver-1 + TEMPEST_VOLUME_DRIVER=lvmdriver-1 + TEMPEST_VOLUME_VENDOR="Open Source" + TEMPEST_STORAGE_PROTOCOL=iSCSI + LIBVIRT_FIREWALL_DRIVER=nova.virt.firewall.NoopFirewallDriver + VIRT_DRIVER=libvirt + ACTIVE_TIMEOUT=120 + BOOT_TIMEOUT=120 + ASSOCIATE_TIMEOUT=120 + TERMINATE_TIMEOUT=120 + + + [[post-config|$CINDER_CONF]] + [DEFAULT] + [lvmdriver-1] + volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver + volume_group=stack-volumes-1 + volume_backend_name=lvmdriver-1`` + diff --git a/tempest_tests/__init__.py b/tempest_tests/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tempest_tests/config.py b/tempest_tests/config.py new file mode 100644 index 00000000000..72fd9415810 --- /dev/null +++ b/tempest_tests/config.py @@ -0,0 +1,26 @@ +# Copyright 2016 +# All Rights Reserved. +# +# 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. + +from oslo_config import cfg + +service_available_group = cfg.OptGroup(name="service_available", + title="Available OpenStack Services") + + +ServiceAvailableGroup = [ + cfg.BoolOpt("cinder", + default=True, + help="Whether or not cinder is expected to be available"), +] diff --git a/tempest_tests/plugin.py b/tempest_tests/plugin.py new file mode 100644 index 00000000000..bbb789a9069 --- /dev/null +++ b/tempest_tests/plugin.py @@ -0,0 +1,39 @@ +# Copyright 2015 +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +import os + +from tempest import config +from tempest.test_discover import plugins + +from tempest_tests import config as project_config + + +class CinderTempestPlugin(plugins.TempestPlugin): + def load_tests(self): + base_path = os.path.split(os.path.dirname( + os.path.abspath(__file__)))[0] + test_dir = "tempest_tests/tests" + full_test_dir = os.path.join(base_path, test_dir) + return full_test_dir, base_path + + def register_opts(self, conf): + config.register_opt_group( + conf, project_config.service_available_group, + project_config.ServiceAvailableGroup) + + def get_opt_lists(self): + pass diff --git a/tempest_tests/services/__init__.py b/tempest_tests/services/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tempest_tests/tests/__init__.py b/tempest_tests/tests/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tempest_tests/tests/api/__init__.py b/tempest_tests/tests/api/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tempest_tests/tests/api/volume/__init__.py b/tempest_tests/tests/api/volume/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tempest_tests/tests/api/volume/test_volume_placeholder.py b/tempest_tests/tests/api/volume/test_volume_placeholder.py new file mode 100644 index 00000000000..4c82675f947 --- /dev/null +++ b/tempest_tests/tests/api/volume/test_volume_placeholder.py @@ -0,0 +1,28 @@ +# Copyright 2015 +# All Rights Reserved. +# +# 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. + +from tempest import config +from tempest.tests import base + +CONF = config.CONF + + +class CinderPlaceholderTest(base.TestCase): + """Placeholder test for adding in-tree Cinder tempest tests.""" + # TODO(smcginnis) Remove once real tests are added + + def test_placeholder(self): + expected = 'This test is temporary and should be removed!' + self.assertEqual(expected, expected) diff --git a/tempest_tests/tests/scenario/__init__.py b/tempest_tests/tests/scenario/__init__.py new file mode 100644 index 00000000000..e69de29bb2d