Initial work for zun tempest plugin

This patch does some initial work for zun tempest plugin
support. Since zun API design/implementation will come
soon, tempest API test will be helpful to verify its
correctness.

Co-Authored-By: Ethan Lynn <xjunlin@cn.ibm.com>
Change-Id: Iabc8429285150857fb9791dea8a5471e2995e17b
This commit is contained in:
yanyanhu 2016-06-17 04:21:02 -04:00
commit d24f5aa6e0
7 changed files with 154 additions and 0 deletions

View File

@ -0,0 +1,17 @@
==============
Tempest Plugin
==============
This directory contains Tempest tests to cover Zun project.
To list all Zun tempest cases, go to tempest directory, then run::
$ testr list-tests zun
To run only these tests in tempest, go to tempest directory, then run::
$ ./run_tempest.sh -N -- zun
To run a single test case, go to tempest directory, then run with test case name, e.g.::
$ ./run_tempest.sh -- -N zun.tests.tempest.api.test_basic.TestBasic.test_basic

View File

@ -0,0 +1,24 @@
# 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.lib import decorators
from zun.tests.tempest import base
class TestBasic(base.BaseZunTest):
@decorators.idempotent_id('a04f61f2-15ae-4200-83b7-1f311b101f65')
def test_basic(self):
# This is a basic test used to verify zun tempest plugin
# works. Remove it after real test cases being added.
pass

View File

@ -0,0 +1,37 @@
#
# 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_log import log
from tempest import config
from tempest import test
CONF = config.CONF
lOG = log.getLogger(__name__)
class BaseZunTest(test.BaseTestCase):
credentials = ['primary']
@classmethod
def skip_checks(cls):
super(BaseZunTest, cls).skip_checks()
if not CONF.service_available.zun:
skip_msg = 'Zun is disabled'
raise cls.skipException(skip_msg)
@classmethod
def setup_clients(cls):
super(BaseZunTest, cls).setup_clients()
pass

View File

@ -0,0 +1,36 @@
#
# 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("zun",
default=True,
help="Whether or not zun is expected to be available"),
]
container_management_group = cfg.OptGroup(
name="container_management", title="Container Management Service Options")
ContainerManagementGroup = [
cfg.StrOpt("catalog_type",
default="container_management",
help="Catalog type of the container management service."),
cfg.IntOpt("wait_timeout",
default=60,
help="Waiting time for a specific status, in seconds.")
]

View File

@ -0,0 +1,40 @@
#
# 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 zun.tests.tempest import config as config_zun
class ZunTempestPlugin(plugins.TempestPlugin):
def load_tests(self):
base_path = os.path.split(os.path.dirname(
os.path.abspath(__file__)))[0]
base_path += '/../..'
test_dir = "zun/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, config_zun.service_available_group,
config_zun.ServiceAvailableGroup)
config.register_opt_group(conf, config_zun.container_management_group,
config_zun.ContainerManagementGroup)
def get_opt_lists(self):
return [(config_zun.container_management_group.name,
config_zun.ContainerManagementGroup)]