From 9bfefbf9ab357ece1aac4eee7b261262dc30852f Mon Sep 17 00:00:00 2001 From: Alexander Chadin <a.chadin@servionica.ru> Date: Fri, 23 Mar 2018 14:36:35 +0300 Subject: [PATCH] Add tempest plugin This patch set adds tempest plugin to register existing tempest tests of watcherclient. It is also required to let devstack-tempest job to launch watcherclient functional tests. Change-Id: I4d906fd597048bb37803a2bb42f8357502cf1b76 --- .stestr.conf | 3 +++ setup.cfg | 2 ++ watcherclient/tests/functional/config.py | 23 ++++++++++++++++ watcherclient/tests/functional/plugin.py | 34 ++++++++++++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 .stestr.conf create mode 100644 watcherclient/tests/functional/config.py create mode 100644 watcherclient/tests/functional/plugin.py diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000..bdc36b6 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=${OS_TEST_PATH:-./watcherclient/tests/functional} +top_dir=./ \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 0fdda87..0b271c4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -25,6 +25,8 @@ packages = [entry_points] console_scripts = watcher = watcherclient.shell:main +tempest.test_plugins = + watcherclient_tests = watcherclient.tests.functional.plugin:WatcherClientTempestPlugin openstack.cli.extension = infra_optim = watcherclient.osc.plugin diff --git a/watcherclient/tests/functional/config.py b/watcherclient/tests/functional/config.py new file mode 100644 index 0000000..892d34e --- /dev/null +++ b/watcherclient/tests/functional/config.py @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- +# Copyright (c) 2018 Servionica +# +# 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_option = cfg.BoolOpt("watcher_client", + default=True, + help="Whether or not watcher_client is expected" + "to be available") diff --git a/watcherclient/tests/functional/plugin.py b/watcherclient/tests/functional/plugin.py new file mode 100644 index 0000000..30339bd --- /dev/null +++ b/watcherclient/tests/functional/plugin.py @@ -0,0 +1,34 @@ +# 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.test_discover import plugins + +from watcherclient.tests.functional import config as watcher_config + + +class WatcherClientTempestPlugin(plugins.TempestPlugin): + def load_tests(self): + base_path = os.path.split(os.path.dirname( + os.path.abspath(__file__)))[0] + test_dir = "watcherclient/tests/functional" + full_test_dir = os.path.join(base_path, test_dir) + return full_test_dir, base_path + + def register_opts(self, conf): + conf.register_opt(watcher_config.service_option, + group='service_available') + + def get_opt_lists(self): + return [('service_available', [watcher_config.service_option])]