summaryrefslogtreecommitdiff
path: root/tempest/hacking
diff options
context:
space:
mode:
authorKen'ichi Ohmichi <ken-oomichi@wx.jp.nec.com>2017-05-01 16:56:14 -0700
committerKen'ichi Ohmichi <ken-oomichi@wx.jp.nec.com>2017-05-23 14:00:27 -0700
commitf741d0b35a069d2fc47e7ea1baeaf1f4ff6344d3 (patch)
tree69069de0ee41f911d1246f6b53a349f2341b0835 /tempest/hacking
parentd64c46b776b86d39bd96c7ac140af894067620d5 (diff)
downloadtempest-f741d0b35a069d2fc47e7ea1baeaf1f4ff6344d3.tar.gz
Add T115 for admin test path
Sometimes commiters tried to add tempest tests which require admin credential under non-admin test path and that caused confusions to tempest users. This patch adds some coding rule to make test path clear for the maintenance. NOTE: This patch adds #noqa to AbsoluteLimitsTests because the test class needs force_tenant_isolation which requires admin credential indirectly but the test itself is not admin test. The history is Id71a705cf9b1dd0c0d41a2fb45ab77c95430a123 Change-Id: Id11eec13f2e431af8bbb83ac4904b2047e7932a7
Diffstat (limited to 'tempest/hacking')
-rw-r--r--tempest/hacking/checks.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tempest/hacking/checks.py b/tempest/hacking/checks.py
index 4123ae565..067da09a5 100644
--- a/tempest/hacking/checks.py
+++ b/tempest/hacking/checks.py
@@ -273,6 +273,27 @@ def dont_use_config_in_tempest_lib(logical_line, filename):
yield(0, msg)
+def dont_put_admin_tests_on_nonadmin_path(logical_line, physical_line,
+ filename):
+ """Check admin tests should exist under admin path
+
+ T115
+ """
+
+ if 'tempest/api/' not in filename:
+ return
+
+ if pep8.noqa(physical_line):
+ return
+
+ if not re.match('class .*Test.*\(.*Admin.*\):', logical_line):
+ return
+
+ if not re.match('.\/tempest\/api\/.*\/admin\/.*', filename):
+ msg = 'T115: All admin tests should exist under admin path.'
+ yield(0, msg)
+
+
def factory(register):
register(import_no_clients_in_api_and_scenario_tests)
register(scenario_tests_need_service_tags)
@@ -287,3 +308,4 @@ def factory(register):
register(dont_import_local_tempest_into_lib)
register(dont_use_config_in_tempest_lib)
register(use_rand_uuid_instead_of_uuid4)
+ register(dont_put_admin_tests_on_nonadmin_path)