Set max microversion for some hypervisor tests to 2.52
The following tests:
* test_list_servers_on_hypervisor [0]
* test_search_hypervisor [1]
are deprecated from 2.53 onward. So this is to add max_microversion = 2.52
for these tests. This is also consistent with Tempest [2].
[0] https://developer.openstack.org/api-ref/compute/#list-hypervisor-servers
[1] https://developer.openstack.org/api-ref/compute/#search-hypervisor
[2] https://github.com/openstack/tempest/blob/28b252f7f61a2dfc585089265cdb3118defbcfff/tempest/api/compute/admin/test_hypervisor.py#L108
Partially Implements blueprint: clear-deprecated-api
Change-Id: Iec782e680e2b3429db325d7b575c3b3b5eb4a8c2
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 cb1515f..33f40e7 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_hypervisor_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_hypervisor_rbac.py
@@ -60,15 +60,6 @@
with self.rbac_utils.override_role(self):
self.hypervisor_client.show_hypervisor(self.hypervisor['id'])
- @decorators.idempotent_id('b86f03cf-2e79-4d88-9eea-62f761591413')
- @rbac_rule_validation.action(
- service="nova",
- rule="os_compute_api:os-hypervisors")
- def test_list_servers_on_hypervisor(self):
- with self.rbac_utils.override_role(self):
- self.hypervisor_client.list_servers_on_hypervisor(
- self.hypervisor['hypervisor_hostname'])
-
@decorators.idempotent_id('ca0e465c-6365-4a7f-ae58-6f8ddbca06c2')
@rbac_rule_validation.action(
service="nova",
@@ -86,6 +77,37 @@
self.hypervisor_client.show_hypervisor_uptime(
self.hypervisor['id'])
+
+class HypervisorMaxv252RbacTest(rbac_base.BaseV2ComputeRbacTest):
+ # These tests will fail with a 404 starting from microversion 2.53:
+ # See the following links for details:
+ # https://developer.openstack.org/api-ref/compute/#list-hypervisor-servers
+ # https://developer.openstack.org/api-ref/compute/#search-hypervisor
+ max_microversion = '2.52'
+
+ @classmethod
+ def skip_checks(cls):
+ super(HypervisorMaxv252RbacTest, cls).skip_checks()
+ if not utils.is_extension_enabled('os-hypervisors', 'compute'):
+ msg = "%s skipped as os-hypervisors extension not enabled." \
+ % cls.__name__
+ raise cls.skipException(msg)
+
+ @classmethod
+ def resource_setup(cls):
+ super(HypervisorMaxv252RbacTest, cls).resource_setup()
+ cls.hypervisor =\
+ cls.hypervisor_client.list_hypervisors()['hypervisors'][0]
+
+ @decorators.idempotent_id('b86f03cf-2e79-4d88-9eea-62f761591413')
+ @rbac_rule_validation.action(
+ service="nova",
+ rule="os_compute_api:os-hypervisors")
+ def test_list_servers_on_hypervisor(self):
+ with self.rbac_utils.override_role(self):
+ self.hypervisor_client.list_servers_on_hypervisor(
+ self.hypervisor['hypervisor_hostname'])
+
@decorators.idempotent_id('3dbc71c1-8f04-4674-a67c-dcb2fd99b1b4')
@rbac_rule_validation.action(
service="nova",