From cacca209ab4458378a9e2522ff50078826933c3e Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Fri, 11 Oct 2019 15:48:56 +0200 Subject: [PATCH] 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 --- nova/tests/functional/test_boot_from_volume.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nova/tests/functional/test_boot_from_volume.py b/nova/tests/functional/test_boot_from_volume.py index 660c9622f99..8de80f0ed35 100644 --- a/nova/tests/functional/test_boot_from_volume.py +++ b/nova/tests/functional/test_boot_from_volume.py @@ -196,9 +196,12 @@ def test_boot_from_volume_10_servers_255_volumes_2_images(self): # 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')