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:
parent
d2c3e102fd
commit
caac5fc12c
@ -91,9 +91,17 @@ class TestImageImportLocking(functional.SynchronousAPIBase):
|
||||
|
||||
# Try a second copy-image import. If we are warping time,
|
||||
# expect the lock to be busted. If not, then we should get
|
||||
# a 409 Conflict.
|
||||
resp = self._import_copy(image_id, ['store3'])
|
||||
time.sleep(0.1)
|
||||
# a 409 Conflict. We should make sure to wait until it gets started
|
||||
# before looking for the task id.
|
||||
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',
|
||||
ttc.text_content(str(resp)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user