commit 6f67e3787338407e637d80a6fad0edb5f9a08b24 Author: Chandan Kumar Date: Mon May 2 10:19:22 2016 +0000 Move and rename tempest_tests to cinder/tests/tempest To avoid conflicts, it needs to be done and the subdirs 'api' and 'scenario' directly under the cinder/tests/tempest directory Closes-Bug: #1577016 Change-Id: I5b8d1411e0917ecb7e70eb5a6b139d75437ba032 diff --git a/cinder/tests/tempest/README.rst b/cinder/tests/tempest/README.rst new file mode 100644 index 0000000..a695781 --- /dev/null +++ b/cinder/tests/tempest/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/cinder/tests/tempest/__init__.py b/cinder/tests/tempest/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cinder/tests/tempest/api/__init__.py b/cinder/tests/tempest/api/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cinder/tests/tempest/api/volume/__init__.py b/cinder/tests/tempest/api/volume/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cinder/tests/tempest/api/volume/test_volume_placeholder.py b/cinder/tests/tempest/api/volume/test_volume_placeholder.py new file mode 100644 index 0000000..4c82675 --- /dev/null +++ b/cinder/tests/tempest/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/cinder/tests/tempest/config.py b/cinder/tests/tempest/config.py new file mode 100644 index 0000000..72fd941 --- /dev/null +++ b/cinder/tests/tempest/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/cinder/tests/tempest/plugin.py b/cinder/tests/tempest/plugin.py new file mode 100644 index 0000000..7760fb9 --- /dev/null +++ b/cinder/tests/tempest/plugin.py @@ -0,0 +1,38 @@ +# 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 cinder +import os + +from cinder.tests.tempest import config as project_config +from tempest import config +from tempest.test_discover import plugins + + +class CinderTempestPlugin(plugins.TempestPlugin): + def load_tests(self): + base_path = os.path.split(os.path.dirname( + os.path.abspath(cinder.__file__)))[0] + test_dir = "cinder/tests/tempest" + 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/cinder/tests/tempest/scenario/__init__.py b/cinder/tests/tempest/scenario/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cinder/tests/tempest/services/__init__.py b/cinder/tests/tempest/services/__init__.py new file mode 100644 index 0000000..e69de29