Don't override images client in compute admin tests
Tests should be explicit about their use of admin credentials. The
base compute admin tests class overrode self.image_client with the
admin version. Stop doing that, and introduce a new
self.admin_image_client client that tests can explicitly use.
Needed-by: https://review.opendev.org/c/openstack/whitebox-tempest-plugin/+/805300
Change-Id: I1a0c84b41b1b77d3a618a8f15448909bd12a0742
diff --git a/tempest/api/compute/admin/test_volume.py b/tempest/api/compute/admin/test_volume.py
index cf8c560..549d4fb 100644
--- a/tempest/api/compute/admin/test_volume.py
+++ b/tempest/api/compute/admin/test_volume.py
@@ -48,8 +48,8 @@
:param return image_id: The UUID of the newly created image.
"""
- image = self.image_client.show_image(CONF.compute.image_ref)
- image_data = self.image_client.show_image_file(
+ image = self.admin_image_client.show_image(CONF.compute.image_ref)
+ image_data = self.admin_image_client.show_image_file(
CONF.compute.image_ref).data
image_file = io.BytesIO(image_data)
create_dict = {
@@ -60,11 +60,11 @@
'visibility': 'public',
}
create_dict.update(kwargs)
- new_image = self.image_client.create_image(**create_dict)
- self.addCleanup(self.image_client.wait_for_resource_deletion,
+ new_image = self.admin_image_client.create_image(**create_dict)
+ self.addCleanup(self.admin_image_client.wait_for_resource_deletion,
new_image['id'])
- self.addCleanup(self.image_client.delete_image, new_image['id'])
- self.image_client.store_image_file(new_image['id'], image_file)
+ self.addCleanup(self.admin_image_client.delete_image, new_image['id'])
+ self.admin_image_client.store_image_file(new_image['id'], image_file)
return new_image['id']
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 922a14c..a6ff965 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -658,7 +658,7 @@
cls.os_admin.availability_zone_client)
cls.admin_flavors_client = cls.os_admin.flavors_client
cls.admin_servers_client = cls.os_admin.servers_client
- cls.image_client = cls.os_admin.image_client_v2
+ cls.admin_image_client = cls.os_admin.image_client_v2
cls.admin_assisted_volume_snapshots_client = \
cls.os_admin.assisted_volume_snapshots_client