Do not assume order of images
This fixes the test_tag_lifecycle test, which broke with a randomized PYTHONHASHSEED. Previously, the test assumed that the values in the list of tag names would remain constant. The test now sorts the results and compares to a sorted set. Change-Id: If5a2ef683fcf55520c7d539f1b90aefaba4739d5 Partial-bug: #1348818
This commit is contained in:
parent
653efdd99a
commit
68f5243e23
|
@ -1583,14 +1583,14 @@ class TestImages(functional.FunctionalTest):
|
|||
response = requests.patch(path, headers=headers, data=data)
|
||||
self.assertEqual(200, response.status_code)
|
||||
tags = jsonutils.loads(response.text)['tags']
|
||||
self.assertEqual(['snozz', 'sniff'], tags)
|
||||
self.assertEqual(['sniff', 'snozz'], sorted(tags))
|
||||
|
||||
# Image should show the appropriate tags
|
||||
path = self._url('/v2/images/%s' % image_id)
|
||||
response = requests.get(path, headers=self._headers())
|
||||
self.assertEqual(200, response.status_code)
|
||||
tags = jsonutils.loads(response.text)['tags']
|
||||
self.assertEqual(['snozz', 'sniff'], tags)
|
||||
self.assertEqual(['sniff', 'snozz'], sorted(tags))
|
||||
|
||||
# Attempt to tag the image with a duplicate should be ignored
|
||||
path = self._url('/v2/images/%s/tags/snozz' % image_id)
|
||||
|
@ -1607,7 +1607,8 @@ class TestImages(functional.FunctionalTest):
|
|||
response = requests.get(path, headers=self._headers())
|
||||
self.assertEqual(200, response.status_code)
|
||||
tags = jsonutils.loads(response.text)['tags']
|
||||
self.assertEqual(['gabe@example.com', 'snozz', 'sniff'], tags)
|
||||
self.assertEqual(['gabe@example.com', 'sniff', 'snozz'],
|
||||
sorted(tags))
|
||||
|
||||
# Query images by single tag
|
||||
path = self._url('/v2/images?tag=sniff')
|
||||
|
@ -1650,7 +1651,7 @@ class TestImages(functional.FunctionalTest):
|
|||
response = requests.get(path, headers=self._headers())
|
||||
self.assertEqual(200, response.status_code)
|
||||
tags = jsonutils.loads(response.text)['tags']
|
||||
self.assertEqual(['snozz', 'sniff'], tags)
|
||||
self.assertEqual(['sniff', 'snozz'], sorted(tags))
|
||||
|
||||
# Deleting the same tag should return a 404
|
||||
path = self._url('/v2/images/%s/tags/gabe%%40example.com' % image_id)
|
||||
|
|
Loading…
Reference in New Issue