Avoid using image with kernel in BDM large request func test

The test_boot_from_volume_10_servers_255_volumes_2_images uses two
random images to build servers with a lot of BDMs and asserts that an
image cache is used to avoid hitting glance for the same image many
times. The functional tests uses _FakeImageService that predefines a
list of images. The test selects the first two returned by the
api.get_images() call. As the fixture stores the images in a dict the
returned image list is random in python2.7. Therefore the test runs with
two random images. One of the images
c905cedb-7281-47e4-8a62-f26bc5fc4c77 is defined to use a separate kernel
image. If this image is selected for the test then an extra glance call
is made from _handle_kernel_and_ramdisk(). This makes the test unstable
as sometimes there is 4 calls instead of the asserted (and more common)
3 calls nova.image.api.API.get().

This patch hardcodes the image_ids used in the test to avoid the
instability.

Change-Id: Ic0a9c3ffb4e52430deb26bc6ad7758105f02968b
Closes-Bug: #1847766
This commit is contained in:
Balazs Gibizer 2019-10-11 15:48:56 +02:00
parent d3403e5294
commit cacca209ab

View File

@ -196,9 +196,12 @@ class BootFromVolumeLargeRequestTest(test.TestCase,
# We only care about API performance in this test case so stub out
# conductor to not do anything.
self.useFixture(nova_fixtures.NoopConductorFixture())
images = self.api.get_images()
image1 = images[0]['id']
image2 = images[1]['id']
# NOTE(gibi): Do not use 'c905cedb-7281-47e4-8a62-f26bc5fc4c77' image
# as that is defined with a separate kernel image, leading to one extra
# call to nova.image.api.API.get from compute.api
# _handle_kernel_and_ramdisk()
image1 = 'a2459075-d96c-40d5-893e-577ff92e721c'
image2 = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6'
server = self._build_minimal_create_server_request(
self.api, 'test_boot_from_volume_10_servers_255_volumes_2_images')
server.pop('imageRef')