Switch to admin role during client set up to fix some gate bugs.
The current framework only adds the admin role to
the cls.os.<client-name> namespace when switchToRbacRole=False
is executed; meaning that the first test that is executed
in a test run will not have the admin role during set up.
Thus, it is necessary to add a switch_role with
switchToRbacRole=False to setup_clients (after rbac_utils
is instantiated), so that class-level resources are set
up with admin credentials. This is why
test_flavor_extra_specs_rbac is currently failing [0].
(setup_clients is called before resource_setup.)
This patch:
* Performs switchToRbacRole=False in the setup_clients
of every base Patrole test class.
[0] http://logs.openstack.org/94/444994/2/check/gate-tempest-dsvm-patrole-admin-ubuntu-xenial-nv/a00e22a/console.html
Change-Id: I8027938daa4fdfff0ac5336324aa6d647322237b
Partial-Bug: #1670553
diff --git a/patrole_tempest_plugin/tests/api/compute/rbac_base.py b/patrole_tempest_plugin/tests/api/compute/rbac_base.py
index de544bb..625b5cf 100644
--- a/patrole_tempest_plugin/tests/api/compute/rbac_base.py
+++ b/patrole_tempest_plugin/tests/api/compute/rbac_base.py
@@ -38,6 +38,7 @@
super(BaseV2ComputeRbacTest, cls).setup_clients()
cls.auth_provider = cls.os.auth_provider
cls.rbac_utils = rbac_utils()
+ cls.rbac_utils.switch_role(cls, switchToRbacRole=False)
class BaseV2ComputeAdminRbacTest(compute_base.BaseV2ComputeAdminTest):
@@ -56,6 +57,7 @@
super(BaseV2ComputeAdminRbacTest, cls).setup_clients()
cls.auth_provider = cls.os.auth_provider
cls.rbac_utils = rbac_utils()
+ cls.rbac_utils.switch_role(cls, switchToRbacRole=False)
@classmethod
def resource_setup(cls):
diff --git a/patrole_tempest_plugin/tests/api/identity/v2/rbac_base.py b/patrole_tempest_plugin/tests/api/identity/v2/rbac_base.py
index e7cca4a..ffee5c0 100644
--- a/patrole_tempest_plugin/tests/api/identity/v2/rbac_base.py
+++ b/patrole_tempest_plugin/tests/api/identity/v2/rbac_base.py
@@ -41,6 +41,7 @@
cls.tenants_client = cls.os.tenants_client
cls.users_client = cls.os.users_client
cls.rbac_utils = rbac_utils()
+ cls.rbac_utils.switch_role(cls, switchToRbacRole=False)
def _create_service(self):
name = data_utils.rand_name('service')
diff --git a/patrole_tempest_plugin/tests/api/identity/v3/rbac_base.py b/patrole_tempest_plugin/tests/api/identity/v3/rbac_base.py
index 3f045f2..7a67459 100644
--- a/patrole_tempest_plugin/tests/api/identity/v3/rbac_base.py
+++ b/patrole_tempest_plugin/tests/api/identity/v3/rbac_base.py
@@ -44,6 +44,7 @@
cls.groups_client = cls.os.groups_client
cls.policies_client = cls.os.policies_client
cls.rbac_utils = rbac_utils()
+ cls.rbac_utils.switch_role(cls, switchToRbacRole=False)
def _create_service(self):
"""Creates a service for test."""
diff --git a/patrole_tempest_plugin/tests/api/image/rbac_base.py b/patrole_tempest_plugin/tests/api/image/rbac_base.py
index daea89c..b4fed7d 100644
--- a/patrole_tempest_plugin/tests/api/image/rbac_base.py
+++ b/patrole_tempest_plugin/tests/api/image/rbac_base.py
@@ -35,6 +35,7 @@
super(BaseV1ImageRbacTest, cls).setup_clients()
cls.auth_provider = cls.os.auth_provider
cls.rbac_utils = rbac_utils()
+ cls.rbac_utils.switch_role(cls, switchToRbacRole=False)
class BaseV2ImageRbacTest(image_base.BaseV2ImageTest):
@@ -53,3 +54,4 @@
super(BaseV2ImageRbacTest, cls).setup_clients()
cls.auth_provider = cls.os.auth_provider
cls.rbac_utils = rbac_utils()
+ cls.rbac_utils.switch_role(cls, switchToRbacRole=False)
diff --git a/patrole_tempest_plugin/tests/api/network/rbac_base.py b/patrole_tempest_plugin/tests/api/network/rbac_base.py
index af5d110..de5ed88 100644
--- a/patrole_tempest_plugin/tests/api/network/rbac_base.py
+++ b/patrole_tempest_plugin/tests/api/network/rbac_base.py
@@ -37,3 +37,4 @@
super(BaseNetworkRbacTest, cls).setup_clients()
cls.auth_provider = cls.os.auth_provider
cls.rbac_utils = rbac_utils()
+ cls.rbac_utils.switch_role(cls, switchToRbacRole=False)
diff --git a/patrole_tempest_plugin/tests/api/orchestration/rbac_base.py b/patrole_tempest_plugin/tests/api/orchestration/rbac_base.py
index 562c66e..f90decc 100644
--- a/patrole_tempest_plugin/tests/api/orchestration/rbac_base.py
+++ b/patrole_tempest_plugin/tests/api/orchestration/rbac_base.py
@@ -35,6 +35,7 @@
super(BaseOrchestrationRbacTest, cls).setup_clients()
cls.auth_provider = cls.os.auth_provider
cls.rbac_utils = rbac_utils()
+ cls.rbac_utils.switch_role(cls, switchToRbacRole=False)
def tearDown(self):
self.rbac_utils.switch_role(self, switchToRbacRole=False)
diff --git a/patrole_tempest_plugin/tests/api/volume/rbac_base.py b/patrole_tempest_plugin/tests/api/volume/rbac_base.py
index 005986d..c762473 100644
--- a/patrole_tempest_plugin/tests/api/volume/rbac_base.py
+++ b/patrole_tempest_plugin/tests/api/volume/rbac_base.py
@@ -35,6 +35,7 @@
super(BaseVolumeRbacTest, cls).setup_clients()
cls.auth_provider = cls.os.auth_provider
cls.rbac_utils = rbac_utils()
+ cls.rbac_utils.switch_role(cls, switchToRbacRole=False)
class BaseVolumeAdminRbacTest(vol_base.BaseVolumeAdminTest):
@@ -53,6 +54,7 @@
super(BaseVolumeAdminRbacTest, cls).setup_clients()
cls.auth_provider = cls.os.auth_provider
cls.rbac_utils = rbac_utils()
+ cls.rbac_utils.switch_role(cls, switchToRbacRole=False)
version_checker = {
1: [cls.os.volume_hosts_client, cls.os.volume_types_client],
2: [cls.os.volume_hosts_v2_client, cls.os.volume_types_v2_client]