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
This commit is contained in:
Sean McGinnis 2016-01-31 16:03:58 -06:00
parent c874132ea5
commit b906aee01d
11 changed files with 159 additions and 1 deletions

View File

@ -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

62
tempest_tests/README.rst Normal file
View File

@ -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``

View File

26
tempest_tests/config.py Normal file
View File

@ -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"),
]

39
tempest_tests/plugin.py Normal file
View File

@ -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

View File

View File

View File

View File

@ -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)

View File