Modify unit test case test_list_image_sorted

Currently test_list_image_sorted is using NameGenerator
class to generate image name in loop. NameGenerator may
generate duplicate names in the loop which may cause failure
of the test case, this patch fixes that by giving predefined names
instead of names generated at runtime.

Closes-Bug: #1636117
Change-Id: I8d550aa74d587905e4ef4d3be21138e35aec0909
This commit is contained in:
Pradeep Kumar Singh
2016-10-24 09:18:22 +00:00
parent f0775849b4
commit 756fd24514

View File

@@ -70,9 +70,9 @@ class DbImageTestCase(base.DbTestCase):
def test_list_image_sorted(self):
uuids = []
for _ in range(5):
for i in range(5):
image = utils.create_test_image(
uuid=uuidutils.generate_uuid())
uuid=uuidutils.generate_uuid(), repo="testrepo" + str(i))
uuids.append(six.text_type(image.uuid))
res = self.dbapi.list_image(self.context, sort_key='uuid')
res_uuids = [r.uuid for r in res]