From 50783c14f1ea732c35420a1714c8a5ee849cd009 Mon Sep 17 00:00:00 2001 From: Anton Arefiev Date: Thu, 17 Mar 2016 09:38:17 +0200 Subject: [PATCH] Tempest plugin initial commit This patch contains tempest plugin interface which are generated by tempest-plugin-cookiecutter[1]. Also empty test manager and basic test was added. [1] https://github.com/openstack/tempest-plugin-cookiecutter Change-Id: I333462987bb6cdd1933fbb3550f527364c74ba07 --- .../test/inspector_tempest_plugin/README.rst | 18 ++++++++++ .../test/inspector_tempest_plugin/__init__.py | 0 .../test/inspector_tempest_plugin/config.py | 13 +++++++ .../test/inspector_tempest_plugin/plugin.py | 34 +++++++++++++++++++ .../services/__init__.py | 0 .../tests/__init__.py | 0 .../tests/api/__init__.py | 0 .../tests/scenario/__init__.py | 0 .../tests/scenario/manager.py | 26 ++++++++++++++ .../tests/scenario/test_basic.py | 27 +++++++++++++++ setup.cfg | 3 ++ 11 files changed, 121 insertions(+) create mode 100644 ironic_inspector/test/inspector_tempest_plugin/README.rst create mode 100644 ironic_inspector/test/inspector_tempest_plugin/__init__.py create mode 100644 ironic_inspector/test/inspector_tempest_plugin/config.py create mode 100644 ironic_inspector/test/inspector_tempest_plugin/plugin.py create mode 100644 ironic_inspector/test/inspector_tempest_plugin/services/__init__.py create mode 100644 ironic_inspector/test/inspector_tempest_plugin/tests/__init__.py create mode 100644 ironic_inspector/test/inspector_tempest_plugin/tests/api/__init__.py create mode 100644 ironic_inspector/test/inspector_tempest_plugin/tests/scenario/__init__.py create mode 100644 ironic_inspector/test/inspector_tempest_plugin/tests/scenario/manager.py create mode 100644 ironic_inspector/test/inspector_tempest_plugin/tests/scenario/test_basic.py diff --git a/ironic_inspector/test/inspector_tempest_plugin/README.rst b/ironic_inspector/test/inspector_tempest_plugin/README.rst new file mode 100644 index 000000000..5ccb57d48 --- /dev/null +++ b/ironic_inspector/test/inspector_tempest_plugin/README.rst @@ -0,0 +1,18 @@ +======================================= +Tempest Integration of ironic-inspector +======================================= + +This directory contains Tempest tests to cover the ironic-inspector project. + +It uses tempest plugin to automatically load these tests into tempest. More +information about tempest plugin could be found here: +`Plugin `_ + +The legacy method of running Tempest is to just treat the Tempest source code +as a python unittest: +`Run tests `_ + +There is also tox configuration for tempest, use following regex for running +introspection tests:: + + $ tox -e all-plugin -- inspector_tempest_plugin diff --git a/ironic_inspector/test/inspector_tempest_plugin/__init__.py b/ironic_inspector/test/inspector_tempest_plugin/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/ironic_inspector/test/inspector_tempest_plugin/config.py b/ironic_inspector/test/inspector_tempest_plugin/config.py new file mode 100644 index 000000000..27c2fb31a --- /dev/null +++ b/ironic_inspector/test/inspector_tempest_plugin/config.py @@ -0,0 +1,13 @@ +# 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 # noqa diff --git a/ironic_inspector/test/inspector_tempest_plugin/plugin.py b/ironic_inspector/test/inspector_tempest_plugin/plugin.py new file mode 100644 index 000000000..5d9a09358 --- /dev/null +++ b/ironic_inspector/test/inspector_tempest_plugin/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 import config # noqa +from tempest.test_discover import plugins + +from ironic_inspector.test.inspector_tempest_plugin import config # noqa + + +class InspectorTempestPlugin(plugins.TempestPlugin): + def load_tests(self): + base_path = os.path.split(os.path.dirname( + os.path.abspath(__file__)))[0] + test_dir = "inspector_tempest_plugin/tests" + full_test_dir = os.path.join(base_path, test_dir) + return full_test_dir, base_path + + def register_opts(self, conf): + pass + + def get_opt_lists(self): + pass diff --git a/ironic_inspector/test/inspector_tempest_plugin/services/__init__.py b/ironic_inspector/test/inspector_tempest_plugin/services/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/ironic_inspector/test/inspector_tempest_plugin/tests/__init__.py b/ironic_inspector/test/inspector_tempest_plugin/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/ironic_inspector/test/inspector_tempest_plugin/tests/api/__init__.py b/ironic_inspector/test/inspector_tempest_plugin/tests/api/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/ironic_inspector/test/inspector_tempest_plugin/tests/scenario/__init__.py b/ironic_inspector/test/inspector_tempest_plugin/tests/scenario/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/ironic_inspector/test/inspector_tempest_plugin/tests/scenario/manager.py b/ironic_inspector/test/inspector_tempest_plugin/tests/scenario/manager.py new file mode 100644 index 000000000..ad47d2570 --- /dev/null +++ b/ironic_inspector/test/inspector_tempest_plugin/tests/scenario/manager.py @@ -0,0 +1,26 @@ +# 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.scenario import manager + + +class InspectorScenarioTest(manager.BaremetalScenarioTest): + """Provide harness to do Inspector scenario tests.""" + + credentials = ['primary', 'admin'] + + @classmethod + def setup_clients(cls): + super(InspectorScenarioTest, cls).setup_clients() + + def setUp(self): + super(InspectorScenarioTest, self).setUp() diff --git a/ironic_inspector/test/inspector_tempest_plugin/tests/scenario/test_basic.py b/ironic_inspector/test/inspector_tempest_plugin/tests/scenario/test_basic.py new file mode 100644 index 000000000..9b34d3377 --- /dev/null +++ b/ironic_inspector/test/inspector_tempest_plugin/tests/scenario/test_basic.py @@ -0,0 +1,27 @@ +# 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 test # noqa + +from ironic_inspector.test.inspector_tempest_plugin.tests.scenario \ + import manager + + +class InspectorBasicTest(manager.InspectorScenarioTest): + @test.idempotent_id('03bf7990-bee0-4dd7-bf74-b97ad7b52a4b') + @test.services('baremetal', 'compute', 'image', + 'network', 'object_storage') + def test_berametal_introspection_ops(self): + """This smoke test case follows this basic set of operations: + + """ + pass diff --git a/setup.cfg b/setup.cfg index 72b60d0be..8e0338f3f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -61,6 +61,9 @@ oslo.config.opts = oslo.config.opts.defaults = ironic_inspector = ironic_inspector.conf:set_config_defaults +tempest.test_plugins = + ironic_inspector_tests = ironic_inspector.test.inspector_tempest_plugin.plugin:InspectorTempestPlugin + [compile_catalog] directory = ironic_inspector/locale domain = ironic_inspector