Fix test_image_delete
We have a race between deleting the upload and testing that it is indeed deleted since another thread could pop up in between and re-upload the image, which would cause the wait for deletion to eventually time out. Change-Id: I5dfa8474f12153a9bef74bb6ee9f04aee533cf89
This commit is contained in:
parent
d1361d7730
commit
4344fc4263
|
@ -452,11 +452,11 @@ class DBTestCase(BaseTestCase):
|
|||
time.sleep(1)
|
||||
self.wait_for_threads()
|
||||
|
||||
def waitForImageDeletion(self, provider_name, image_name):
|
||||
def waitForImageDeletion(self, provider_name, image_name, match=None):
|
||||
while True:
|
||||
self.wait_for_threads()
|
||||
image = self.zk.getMostRecentImageUpload(image_name, provider_name)
|
||||
if not image:
|
||||
if not image or (match and image != match):
|
||||
break
|
||||
time.sleep(1)
|
||||
self.wait_for_threads()
|
||||
|
|
|
@ -75,7 +75,10 @@ class TestNodepoolCMD(tests.DBTestCase):
|
|||
"--build-id", image.build_id,
|
||||
"--upload-id", image.id)
|
||||
nodepoolcmd.main()
|
||||
self.waitForImageDeletion('fake-provider', 'fake-image')
|
||||
|
||||
# We need to specify the exact image to wait for because it is
|
||||
# possible that the image could be re-uploaded after the delete.
|
||||
self.waitForImageDeletion('fake-provider', 'fake-image', image)
|
||||
|
||||
def test_alien_list_fail(self):
|
||||
def fail_list(self):
|
||||
|
|
Loading…
Reference in New Issue