Stop violating image disk_format rules
Glance is going to start enforcing that if you upload something and claim it is a different format than the content, the upload will fail. Tempest currently just almost universally uses disk_formats[0], despite not actually uploading content that matches that format. In most cases it is using random data, which means the format it uses should be "raw". This converts those cases to use raw, and does so assuming raw is always available (as many other tests already do). Change-Id: I06d66b969306b53cd177c2d95c23762db3bc72ea Needed-By: https://review.opendev.org/c/openstack/glance/+/930492
This commit is contained in:
parent
f4a3be7e35
commit
507d0dec2c
@ -47,7 +47,7 @@ class FlavorsV2NegativeTest(base.BaseV2ComputeTest):
|
|||||||
'name': data_utils.rand_name(
|
'name': data_utils.rand_name(
|
||||||
prefix=CONF.resource_name_prefix, name='image'),
|
prefix=CONF.resource_name_prefix, name='image'),
|
||||||
'container_format': CONF.image.container_formats[0],
|
'container_format': CONF.image.container_formats[0],
|
||||||
'disk_format': CONF.image.disk_formats[0],
|
'disk_format': 'raw',
|
||||||
'min_ram': min_img_ram,
|
'min_ram': min_img_ram,
|
||||||
'visibility': 'private'
|
'visibility': 'private'
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ class ImportCopyImagesTest(base.BaseV2ImageAdminTest):
|
|||||||
image_name = data_utils.rand_name(
|
image_name = data_utils.rand_name(
|
||||||
prefix=CONF.resource_name_prefix, name='copy-image')
|
prefix=CONF.resource_name_prefix, name='copy-image')
|
||||||
container_format = CONF.image.container_formats[0]
|
container_format = CONF.image.container_formats[0]
|
||||||
disk_format = CONF.image.disk_formats[0]
|
disk_format = 'raw'
|
||||||
image = self.create_image(name=image_name,
|
image = self.create_image(name=image_name,
|
||||||
container_format=container_format,
|
container_format=container_format,
|
||||||
disk_format=disk_format,
|
disk_format=disk_format,
|
||||||
|
@ -56,7 +56,14 @@ class ImportImagesTest(base.BaseV2ImageTest):
|
|||||||
image_name = data_utils.rand_name(
|
image_name = data_utils.rand_name(
|
||||||
prefix=CONF.resource_name_prefix, name='image')
|
prefix=CONF.resource_name_prefix, name='image')
|
||||||
container_format = container_format or CONF.image.container_formats[0]
|
container_format = container_format or CONF.image.container_formats[0]
|
||||||
disk_format = disk_format or CONF.image.disk_formats[0]
|
disk_format = disk_format or 'raw'
|
||||||
|
if disk_format not in CONF.image.disk_formats:
|
||||||
|
# If the test asked for some disk format that is not available,
|
||||||
|
# consider that a programming error. Tests with specific
|
||||||
|
# requirements should be checking to see if it is available and
|
||||||
|
# skipping themselves instead of this helper doing it.
|
||||||
|
raise RuntimeError('Test requires unavailable disk_format %s, '
|
||||||
|
'but did not skip' % disk_format)
|
||||||
image = self.create_image(name=image_name,
|
image = self.create_image(name=image_name,
|
||||||
container_format=container_format,
|
container_format=container_format,
|
||||||
disk_format=disk_format,
|
disk_format=disk_format,
|
||||||
@ -390,7 +397,7 @@ class BasicOperationsImagesTest(base.BaseV2ImageTest):
|
|||||||
image_name = data_utils.rand_name(
|
image_name = data_utils.rand_name(
|
||||||
prefix=CONF.resource_name_prefix, name='image')
|
prefix=CONF.resource_name_prefix, name='image')
|
||||||
container_format = CONF.image.container_formats[0]
|
container_format = CONF.image.container_formats[0]
|
||||||
disk_format = CONF.image.disk_formats[0]
|
disk_format = 'raw'
|
||||||
image = self.create_image(name=image_name,
|
image = self.create_image(name=image_name,
|
||||||
container_format=container_format,
|
container_format=container_format,
|
||||||
disk_format=disk_format,
|
disk_format=disk_format,
|
||||||
@ -754,7 +761,7 @@ class ListSharedImagesTest(base.BaseV2ImageTest):
|
|||||||
# Create an image to be shared using default visibility
|
# Create an image to be shared using default visibility
|
||||||
image_file = io.BytesIO(data_utils.random_bytes(2048))
|
image_file = io.BytesIO(data_utils.random_bytes(2048))
|
||||||
container_format = CONF.image.container_formats[0]
|
container_format = CONF.image.container_formats[0]
|
||||||
disk_format = CONF.image.disk_formats[0]
|
disk_format = 'raw'
|
||||||
image = self.create_image(container_format=container_format,
|
image = self.create_image(container_format=container_format,
|
||||||
disk_format=disk_format)
|
disk_format=disk_format)
|
||||||
self.client.store_image_file(image['id'], data=image_file)
|
self.client.store_image_file(image['id'], data=image_file)
|
||||||
|
@ -45,7 +45,7 @@ class VolumesNegativeTest(base.BaseVolumeTest):
|
|||||||
image = self.images_client.create_image(
|
image = self.images_client.create_image(
|
||||||
name=image_name,
|
name=image_name,
|
||||||
container_format=CONF.image.container_formats[0],
|
container_format=CONF.image.container_formats[0],
|
||||||
disk_format=CONF.image.disk_formats[0],
|
disk_format='raw',
|
||||||
visibility='private',
|
visibility='private',
|
||||||
min_disk=CONF.volume.volume_size + CONF.volume.volume_size_extend)
|
min_disk=CONF.volume.volume_size + CONF.volume.volume_size_extend)
|
||||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||||
|
Loading…
Reference in New Issue
Block a user