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
This commit is contained in:
Artom Lifshitz 2021-12-01 14:04:15 -05:00
parent 94e2f8fdf2
commit b0ee03e568
2 changed files with 7 additions and 7 deletions

View File

@ -48,8 +48,8 @@ class BaseAttachSCSIVolumeTest(base.BaseV2ComputeAdminTest):
: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 @@ class BaseAttachSCSIVolumeTest(base.BaseV2ComputeAdminTest):
'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']

View File

@ -658,7 +658,7 @@ class BaseV2ComputeAdminTest(BaseV2ComputeTest):
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