Harden copy bust lock test
Hopefully this resolves a race in the test_import_copy_bust_lock test, where we look for the task id before it may have actually started. Change-Id: I69ce5e831fab6ebe061fed7ce32140591769a368
This commit is contained in:
@@ -91,9 +91,17 @@ class TestImageImportLocking(functional.SynchronousAPIBase):
|
|||||||
|
|
||||||
# Try a second copy-image import. If we are warping time,
|
# Try a second copy-image import. If we are warping time,
|
||||||
# expect the lock to be busted. If not, then we should get
|
# expect the lock to be busted. If not, then we should get
|
||||||
# a 409 Conflict.
|
# a 409 Conflict. We should make sure to wait until it gets started
|
||||||
resp = self._import_copy(image_id, ['store3'])
|
# before looking for the task id.
|
||||||
time.sleep(0.1)
|
with mock.patch('glance.location.ImageProxy.set_data') as mock_sd:
|
||||||
|
mock_sd.side_effect = slow_fake_set_data
|
||||||
|
resp = self._import_copy(image_id, ['store3'])
|
||||||
|
|
||||||
|
# Wait to make sure the data stream gets started
|
||||||
|
for i in range(0, 10):
|
||||||
|
if 'running' in state:
|
||||||
|
break
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
self.addDetail('Second import response',
|
self.addDetail('Second import response',
|
||||||
ttc.text_content(str(resp)))
|
ttc.text_content(str(resp)))
|
||||||
|
|||||||
Reference in New Issue
Block a user