Fixes LP#922784
* Removed duplicate test
* Re-ordered resource allocation
Change-Id: I7ec3ad211ce5e1ab33831a84bb4e2a70685d4358
diff --git a/tempest/tests/test_list_images.py b/tempest/tests/test_list_images.py
index 1e30651..65cbe00 100644
--- a/tempest/tests/test_list_images.py
+++ b/tempest/tests/test_list_images.py
@@ -25,14 +25,13 @@
name = rand_name('server')
resp, cls.server1 = cls.servers_client.create_server(name,
- cls.image_ref,
- cls.flavor_ref)
- cls.servers_client.wait_for_server_status(cls.server1['id'], 'ACTIVE')
-
+ cls.image_ref,
+ cls.flavor_ref)
name = rand_name('server')
resp, cls.server2 = cls.servers_client.create_server(name,
- cls.image_ref,
- cls.flavor_ref)
+ cls.image_ref,
+ cls.flavor_ref)
+ cls.servers_client.wait_for_server_status(cls.server1['id'], 'ACTIVE')
cls.servers_client.wait_for_server_status(cls.server2['id'], 'ACTIVE')
# Create images to be used in the filter tests
@@ -43,13 +42,9 @@
cls.client.wait_for_image_status(cls.image1_id, 'ACTIVE')
resp, cls.image1 = cls.client.get_image(cls.image1_id)
- image2_name = rand_name('image')
- resp, body = cls.client.create_image(cls.server1['id'], image2_name)
- cls.image2_id = _parse_image_id(resp['location'])
- cls.client.wait_for_image_resp_code(cls.image2_id, 200)
- cls.client.wait_for_image_status(cls.image2_id, 'ACTIVE')
- resp, cls.image2 = cls.client.get_image(cls.image2_id)
-
+ # Servers have a hidden property for when they are being imaged
+ # Performing back-to-back create image calls on a single
+ # server will sometimes cause failures
image3_name = rand_name('image')
resp, body = cls.client.create_image(cls.server2['id'], image3_name)
cls.image3_id = _parse_image_id(resp['location'])
@@ -57,6 +52,13 @@
cls.client.wait_for_image_status(cls.image3_id, 'ACTIVE')
resp, cls.image3 = cls.client.get_image(cls.image3_id)
+ image2_name = rand_name('image')
+ resp, body = cls.client.create_image(cls.server1['id'], image2_name)
+ cls.image2_id = _parse_image_id(resp['location'])
+ cls.client.wait_for_image_resp_code(cls.image2_id, 200)
+ cls.client.wait_for_image_status(cls.image2_id, 'ACTIVE')
+ resp, cls.image2 = cls.client.get_image(cls.image2_id)
+
@classmethod
def tearDownClass(cls):
cls.client.delete_image(cls.image1_id)
@@ -162,13 +164,6 @@
@attr(type='smoke')
def test_list_images_with_detail(self):
- """Detailed list of all images should contain the expected image"""
- resp, images = self.client.list_images_with_detail()
- found = any([i for i in images if i['id'] == self.image_ref])
- self.assertTrue(found)
-
- @attr(type='smoke')
- def test_list_images_with_detail(self):
"""Detailed list of all images should contain the expected images"""
resp, images = self.client.list_images_with_detail()