Merge "Remove admin namespace throughout Patrole - Nova tests"
diff --git a/patrole_tempest_plugin/tests/api/compute/admin/__init__.py b/patrole_tempest_plugin/tests/api/compute/admin/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/patrole_tempest_plugin/tests/api/compute/admin/__init__.py
+++ /dev/null
diff --git a/patrole_tempest_plugin/tests/api/compute/rbac_base.py b/patrole_tempest_plugin/tests/api/compute/rbac_base.py
index 9da50c6..b2f830e 100644
--- a/patrole_tempest_plugin/tests/api/compute/rbac_base.py
+++ b/patrole_tempest_plugin/tests/api/compute/rbac_base.py
@@ -11,11 +11,10 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.lib.common.utils import data_utils
-from tempest.lib.common.utils import test_utils
-
from tempest.api.compute import base as compute_base
from tempest import config
+from tempest.lib.common.utils import data_utils
+from tempest.lib.common.utils import test_utils
from patrole_tempest_plugin.rbac_utils import rbac_utils
@@ -40,34 +39,15 @@
cls.rbac_utils = rbac_utils()
cls.rbac_utils.switch_role(cls, toggle_rbac_role=False)
-
-class BaseV2ComputeAdminRbacTest(compute_base.BaseV2ComputeAdminTest):
-
- credentials = ['admin', 'primary']
-
- @classmethod
- def skip_checks(cls):
- super(BaseV2ComputeAdminRbacTest, cls).skip_checks()
- if not CONF.rbac.enable_rbac:
- raise cls.skipException(
- '%s skipped as RBAC flag not enabled' % cls.__name__)
-
- @classmethod
- def setup_clients(cls):
- super(BaseV2ComputeAdminRbacTest, cls).setup_clients()
- cls.auth_provider = cls.os.auth_provider
- cls.rbac_utils = rbac_utils()
- cls.rbac_utils.switch_role(cls, toggle_rbac_role=False)
-
@classmethod
def resource_setup(cls):
- super(BaseV2ComputeAdminRbacTest, cls).resource_setup()
+ super(BaseV2ComputeRbacTest, cls).resource_setup()
cls.flavors = []
@classmethod
def resource_cleanup(cls):
cls.clear_flavors()
- super(BaseV2ComputeAdminRbacTest, cls).resource_cleanup()
+ super(BaseV2ComputeRbacTest, cls).resource_cleanup()
@classmethod
def clear_flavors(cls):
diff --git a/patrole_tempest_plugin/tests/api/compute/admin/test_admin_password_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_admin_password_rbac.py
similarity index 73%
rename from patrole_tempest_plugin/tests/api/compute/admin/test_admin_password_rbac.py
rename to patrole_tempest_plugin/tests/api/compute/test_admin_password_rbac.py
index 2c9809e..08a06e6 100644
--- a/patrole_tempest_plugin/tests/api/compute/admin/test_admin_password_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_admin_password_rbac.py
@@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import testtools
-
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
@@ -26,27 +24,24 @@
CONF = config.CONF
-class PasswordAdminRbacTest(rbac_base.BaseV2ComputeAdminRbacTest):
-
- @classmethod
- def setup_clients(cls):
- super(PasswordAdminRbacTest, cls).setup_clients()
- cls.client = cls.servers_client
+class AdminPasswordRbacTest(rbac_base.BaseV2ComputeRbacTest):
@classmethod
def skip_checks(cls):
- super(PasswordAdminRbacTest, cls).skip_checks()
- if not CONF.compute_feature_enabled.api_extensions:
- raise cls.skipException(
- '%s skipped as no compute extensions enabled' % cls.__name__)
+ super(AdminPasswordRbacTest, cls).skip_checks()
+ if not CONF.compute_feature_enabled.change_password:
+ raise cls.skipException('Change password not available.')
+
+ @classmethod
+ def setup_clients(cls):
+ super(AdminPasswordRbacTest, cls).setup_clients()
+ cls.client = cls.servers_client
@classmethod
def resource_setup(cls):
- super(PasswordAdminRbacTest, cls).resource_setup()
+ super(AdminPasswordRbacTest, cls).resource_setup()
cls.server_id = cls.create_test_server(wait_until='ACTIVE')['id']
- @testtools.skipUnless(CONF.compute_feature_enabled.change_password,
- 'Change password not available.')
@rbac_rule_validation.action(
service="nova", rule="os_compute_api:os-admin-password")
@decorators.idempotent_id('908a7d59-3a66-441c-94cf-38e57ed14956')
diff --git a/patrole_tempest_plugin/tests/api/compute/admin/test_admin_server_actions_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_admin_server_actions_rbac.py
similarity index 82%
rename from patrole_tempest_plugin/tests/api/compute/admin/test_admin_server_actions_rbac.py
rename to patrole_tempest_plugin/tests/api/compute/test_admin_server_actions_rbac.py
index 2f0d03e..a2d23af 100644
--- a/patrole_tempest_plugin/tests/api/compute/admin/test_admin_server_actions_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_admin_server_actions_rbac.py
@@ -15,31 +15,31 @@
from tempest import config
from tempest.lib import decorators
+from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
-
CONF = config.CONF
-class ServersAdminRbacTest(rbac_base.BaseV2ComputeAdminRbacTest):
+class AdminServerActionsRbacTest(rbac_base.BaseV2ComputeRbacTest):
@classmethod
def setup_clients(cls):
- super(ServersAdminRbacTest, cls).setup_clients()
+ super(AdminServerActionsRbacTest, cls).setup_clients()
cls.client = cls.servers_client
@classmethod
def skip_checks(cls):
- super(ServersAdminRbacTest, cls).skip_checks()
- if not CONF.compute_feature_enabled.api_extensions:
- raise cls.skipException(
- '%s skipped as no compute extensions enabled' % cls.__name__)
+ super(AdminServerActionsRbacTest, cls).skip_checks()
+ if not test.is_extension_enabled('os-admin-actions', 'compute'):
+ msg = "%s skipped as os-admin-actions not enabled." % cls.__name__
+ raise cls.skipException(msg)
@classmethod
def resource_setup(cls):
- super(ServersAdminRbacTest, cls).resource_setup()
+ super(AdminServerActionsRbacTest, cls).resource_setup()
cls.server_id = cls.create_test_server(wait_until='ACTIVE')['id']
@rbac_rule_validation.action(
diff --git a/patrole_tempest_plugin/tests/api/compute/test_flavor_access_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_flavor_access_rbac.py
index 5c3f55a..2019331 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_flavor_access_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_flavor_access_rbac.py
@@ -14,7 +14,6 @@
# under the License.
from oslo_config import cfg
-from oslo_log import log
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
@@ -24,19 +23,18 @@
from patrole_tempest_plugin.tests.api.compute import rbac_base
CONF = cfg.CONF
-LOG = log.getLogger(__name__)
-class FlavorAccessAdminRbacTest(rbac_base.BaseV2ComputeAdminRbacTest):
+class FlavorAccessRbacTest(rbac_base.BaseV2ComputeRbacTest):
@classmethod
def setup_clients(cls):
- super(FlavorAccessAdminRbacTest, cls).setup_clients()
+ super(FlavorAccessRbacTest, cls).setup_clients()
cls.client = cls.flavors_client
@classmethod
def skip_checks(cls):
- super(FlavorAccessAdminRbacTest, cls).skip_checks()
+ super(FlavorAccessRbacTest, cls).skip_checks()
if not test.is_extension_enabled('OS-FLV-EXT-DATA', 'compute'):
msg = "%s skipped as OS-FLV-EXT-DATA extension not enabled."\
% cls.__name__
@@ -44,7 +42,7 @@
@classmethod
def resource_setup(cls):
- super(FlavorAccessAdminRbacTest, cls).resource_setup()
+ super(FlavorAccessRbacTest, cls).resource_setup()
cls.flavor_id = cls._create_flavor(is_public=False)['id']
cls.public_flavor_id = CONF.compute.flavor_ref
cls.tenant_id = cls.auth_provider.credentials.tenant_id
diff --git a/patrole_tempest_plugin/tests/api/compute/test_flavor_extra_specs_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_flavor_extra_specs_rbac.py
index 0cf789b..0ee8d9a 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_flavor_extra_specs_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_flavor_extra_specs_rbac.py
@@ -22,30 +22,30 @@
from patrole_tempest_plugin.tests.api.compute import rbac_base
-class FlavorExtraSpecsAdminRbacTest(rbac_base.BaseV2ComputeAdminRbacTest):
+class FlavorExtraSpecsRbacTest(rbac_base.BaseV2ComputeRbacTest):
@classmethod
def setup_clients(cls):
- super(FlavorExtraSpecsAdminRbacTest, cls).setup_clients()
+ super(FlavorExtraSpecsRbacTest, cls).setup_clients()
cls.client = cls.flavors_client
@classmethod
def skip_checks(cls):
- super(FlavorExtraSpecsAdminRbacTest, cls).skip_checks()
+ super(FlavorExtraSpecsRbacTest, cls).skip_checks()
if not test.is_extension_enabled('os-flavor-extra-specs', 'compute'):
msg = "os-flavor-extra-specs extension not enabled."
raise cls.skipException(msg)
@classmethod
def resource_setup(cls):
- super(FlavorExtraSpecsAdminRbacTest, cls).resource_setup()
+ super(FlavorExtraSpecsRbacTest, cls).resource_setup()
cls.flavor = cls._create_flavor()
@classmethod
def resource_cleanup(cls):
cls.client.delete_flavor(cls.flavor['id'])
cls.client.wait_for_resource_deletion(cls.flavor['id'])
- super(FlavorExtraSpecsAdminRbacTest, cls).resource_cleanup()
+ super(FlavorExtraSpecsRbacTest, cls).resource_cleanup()
def _set_flavor_extra_spec(self):
rand_key = data_utils.rand_name('key')
diff --git a/patrole_tempest_plugin/tests/api/compute/test_flavor_rxtx_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_flavor_rxtx_rbac.py
index bc33d3b..7f070eb 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_flavor_rxtx_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_flavor_rxtx_rbac.py
@@ -20,16 +20,16 @@
from patrole_tempest_plugin.tests.api.compute import rbac_base
-class FlavorRxtxAdminRbacTest(rbac_base.BaseV2ComputeAdminRbacTest):
+class FlavorRxtxRbacTest(rbac_base.BaseV2ComputeRbacTest):
@classmethod
def setup_clients(cls):
- super(FlavorRxtxAdminRbacTest, cls).setup_clients()
+ super(FlavorRxtxRbacTest, cls).setup_clients()
cls.client = cls.flavors_client
@classmethod
def skip_checks(cls):
- super(FlavorRxtxAdminRbacTest, cls).skip_checks()
+ super(FlavorRxtxRbacTest, cls).skip_checks()
if not test.is_extension_enabled('os-flavor-rxtx', 'compute'):
msg = "os-flavor-rxtx extension not enabled."
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/compute/test_hosts_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_hosts_rbac.py
index b03de11..53e3a70 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_hosts_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_hosts_rbac.py
@@ -22,16 +22,16 @@
CONF = config.CONF
-class HostsAdminRbacTest(rbac_base.BaseV2ComputeAdminRbacTest):
+class HostsRbacTest(rbac_base.BaseV2ComputeRbacTest):
@classmethod
def setup_clients(cls):
- super(HostsAdminRbacTest, cls).setup_clients()
+ super(HostsRbacTest, cls).setup_clients()
cls.client = cls.os.hosts_client
@classmethod
def skip_checks(cls):
- super(HostsAdminRbacTest, cls).skip_checks()
+ super(HostsRbacTest, cls).skip_checks()
if not CONF.compute_feature_enabled.api_extensions:
raise cls.skipException(
'%s skipped as no compute extensions enabled' % cls.__name__)
diff --git a/patrole_tempest_plugin/tests/api/compute/test_hypervisor_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_hypervisor_rbac.py
index 36ac916..ecd0fd3 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_hypervisor_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_hypervisor_rbac.py
@@ -20,16 +20,16 @@
from patrole_tempest_plugin.tests.api.compute import rbac_base
-class HypervisorAdminRbacTest(rbac_base.BaseV2ComputeAdminRbacTest):
+class HypervisorRbacTest(rbac_base.BaseV2ComputeRbacTest):
@classmethod
def setup_clients(cls):
- super(HypervisorAdminRbacTest, cls).setup_clients()
+ super(HypervisorRbacTest, cls).setup_clients()
cls.client = cls.hypervisor_client
@classmethod
def skip_checks(cls):
- super(HypervisorAdminRbacTest, cls).skip_checks()
+ super(HypervisorRbacTest, cls).skip_checks()
if not test.is_extension_enabled('os-hypervisors', 'compute'):
msg = "%s skipped as os-hypervisors extension not enabled." \
% cls.__name__
diff --git a/patrole_tempest_plugin/tests/api/compute/test_instance_usages_audit_log_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_instance_usages_audit_log_rbac.py
index 7b116e4..cff3167 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_instance_usages_audit_log_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_instance_usages_audit_log_rbac.py
@@ -20,12 +20,12 @@
from patrole_tempest_plugin.tests.api.compute import rbac_base
-class InstanceUsagesAuditLogAdminRbacTest(
- rbac_base.BaseV2ComputeAdminRbacTest):
+class InstanceUsagesAuditLogRbacTest(
+ rbac_base.BaseV2ComputeRbacTest):
@classmethod
def skip_checks(cls):
- super(InstanceUsagesAuditLogAdminRbacTest, cls).skip_checks()
+ super(InstanceUsagesAuditLogRbacTest, cls).skip_checks()
if not test.is_extension_enabled('os-instance-usage-audit-log',
'compute'):
msg = "os-instance-usage-audit-log extension not enabled."
@@ -33,7 +33,7 @@
@classmethod
def setup_clients(cls):
- super(InstanceUsagesAuditLogAdminRbacTest, cls).setup_clients()
+ super(InstanceUsagesAuditLogRbacTest, cls).setup_clients()
cls.client = cls.instance_usages_audit_log_client
@decorators.idempotent_id('c80246c0-5c13-4ab0-97ba-91551cd53dc1')
diff --git a/patrole_tempest_plugin/tests/api/compute/test_migrations_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_migrations_rbac.py
index 0a21bcb..fda9071 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_migrations_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_migrations_rbac.py
@@ -22,16 +22,16 @@
CONF = config.CONF
-class MigrationsAdminRbacTest(rbac_base.BaseV2ComputeAdminRbacTest):
+class MigrationsRbacTest(rbac_base.BaseV2ComputeRbacTest):
@classmethod
def setup_clients(cls):
- super(MigrationsAdminRbacTest, cls).setup_clients()
+ super(MigrationsRbacTest, cls).setup_clients()
cls.client = cls.migrations_client
@classmethod
def skip_checks(cls):
- super(MigrationsAdminRbacTest, cls).skip_checks()
+ super(MigrationsRbacTest, cls).skip_checks()
if not CONF.compute_feature_enabled.api_extensions:
raise cls.skipException(
'%s skipped as no compute extensions enabled' % cls.__name__)
diff --git a/patrole_tempest_plugin/tests/api/compute/test_services_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_services_rbac.py
index c25303f..82de5a3 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_services_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_services_rbac.py
@@ -13,28 +13,26 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest import config
from tempest.lib import decorators
+from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
-CONF = config.CONF
-
-class ServicesAdminRbacTest(rbac_base.BaseV2ComputeAdminRbacTest):
+class ServicesRbacTest(rbac_base.BaseV2ComputeRbacTest):
@classmethod
def setup_clients(cls):
- super(ServicesAdminRbacTest, cls).setup_clients()
+ super(ServicesRbacTest, cls).setup_clients()
cls.client = cls.services_client
@classmethod
def skip_checks(cls):
- super(ServicesAdminRbacTest, cls).skip_checks()
- if not CONF.compute_feature_enabled.api_extensions:
+ super(ServicesRbacTest, cls).skip_checks()
+ if not test.is_extension_enabled('os-services', 'compute'):
raise cls.skipException(
- '%s skipped as no compute extensions enabled' % cls.__name__)
+ '%s skipped as os-services not enabled' % cls.__name__)
@rbac_rule_validation.action(
service="nova",