Add Tempest hacking checks
Fix v1 tests to comply
Change-Id: I6bf15fa887158efc1858991c806cbdd9ab23db5c
diff --git a/designate_tempest_plugin/hacking/__init__.py b/designate_tempest_plugin/hacking/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/designate_tempest_plugin/hacking/__init__.py
diff --git a/designate_tempest_plugin/hacking/checks.py b/designate_tempest_plugin/hacking/checks.py
new file mode 100644
index 0000000..366aca3
--- /dev/null
+++ b/designate_tempest_plugin/hacking/checks.py
@@ -0,0 +1,31 @@
+# Copyright 2016 Hewlett Packard Enterprise Development Company, L.P.
+#
+# 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.hacking import checks
+
+
+def factory(register):
+ # Imported from Tempest
+ register(checks.import_no_clients_in_api_and_scenario_tests)
+ register(checks.scenario_tests_need_service_tags)
+ register(checks.no_setup_teardown_class_for_tests)
+ register(checks.no_vi_headers)
+ register(checks.service_tags_not_in_module_path)
+ register(checks.no_hyphen_at_end_of_rand_name)
+ register(checks.no_mutable_default_args)
+ register(checks.no_testtools_skip_decorator)
+ register(checks.get_resources_on_service_clients)
+ register(checks.delete_resources_on_service_clients)
+ register(checks.dont_use_config_in_tempest_lib)
+ register(checks.use_rand_uuid_instead_of_uuid4)
diff --git a/designate_tempest_plugin/tests/api/v1/test_domains.py b/designate_tempest_plugin/tests/api/v1/test_domains.py
index 84e77e5..9c6d1b6 100644
--- a/designate_tempest_plugin/tests/api/v1/test_domains.py
+++ b/designate_tempest_plugin/tests/api/v1/test_domains.py
@@ -31,8 +31,8 @@
cls.client = cls.os.domains_client
@classmethod
- def setUpClass(cls):
- super(DnsDomainsTest, cls).setUpClass()
+ def resource_setup(cls):
+ super(DnsDomainsTest, cls).resource_setup()
cls.setup_domains = list()
for i in range(2):
name = data_utils.rand_name('domain') + '.com.'
@@ -41,10 +41,10 @@
cls.setup_domains.append(domain)
@classmethod
- def tearDownClass(cls):
+ def resource_cleanup(cls):
for domain in cls.setup_domains:
cls.client.delete_domain(domain['id'])
- super(DnsDomainsTest, cls).tearDownClass()
+ super(DnsDomainsTest, cls).resource_cleanup()
def _delete_domain(self, domain_id):
self.client.delete_domain(domain_id)
diff --git a/designate_tempest_plugin/tests/api/v1/test_records.py b/designate_tempest_plugin/tests/api/v1/test_records.py
index 1e395d6..ec15771 100644
--- a/designate_tempest_plugin/tests/api/v1/test_records.py
+++ b/designate_tempest_plugin/tests/api/v1/test_records.py
@@ -30,8 +30,8 @@
cls.client = cls.os.records_client
@classmethod
- def setUpClass(cls):
- super(RecordsTest, cls).setUpClass()
+ def resource_setup(cls):
+ super(RecordsTest, cls).resource_setup()
# Creates domains and Records for testcase
cls.setup_records = list()
@@ -53,11 +53,11 @@
cls.setup_records.append(record)
@classmethod
- def tearDownClass(cls):
+ def resource_cleanup(cls):
for record in cls.setup_records:
cls.client.delete_record(cls.domain['id'], record['id'])
cls.os.domains_client.delete_domain(cls.domain['id'])
- super(RecordsTest, cls).tearDownClass()
+ super(RecordsTest, cls).resource_cleanup()
def _delete_record(self, domain_id, record_id):
self.client.delete_record(domain_id, record_id)
diff --git a/designate_tempest_plugin/tests/api/v1/test_servers.py b/designate_tempest_plugin/tests/api/v1/test_servers.py
index 74639ba..c92c604 100644
--- a/designate_tempest_plugin/tests/api/v1/test_servers.py
+++ b/designate_tempest_plugin/tests/api/v1/test_servers.py
@@ -48,8 +48,8 @@
raise cls.skipException(skip_msg)
@classmethod
- def setUpClass(cls):
- super(ServersAdminTest, cls).setUpClass()
+ def resource_setup(cls):
+ super(ServersAdminTest, cls).resource_setup()
cls.setup_servers = list()
for i in range(2):
@@ -58,10 +58,10 @@
cls.setup_servers.append(server)
@classmethod
- def tearDownClass(cls):
+ def resource_cleanup(cls):
for server in cls.setup_servers:
cls.client.delete_server(server['id'])
- super(ServersAdminTest, cls).tearDownClass()
+ super(ServersAdminTest, cls).resource_cleanup()
def _delete_server(self, server_id):
self.client.delete_server(server_id)
diff --git a/tox.ini b/tox.ini
index cdbccbb..31e305b 100644
--- a/tox.ini
+++ b/tox.ini
@@ -73,3 +73,8 @@
ignore = H302,H306,H402,H404,H405,H904,E126,E128
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*openstack/deprecated*,*lib/python*,*egg,build,tools,.ropeproject
+
+
+[hacking]
+local-check-factory = designate_tempest_plugin.hacking.checks.factory
+