functional: Avoid race and fix use of self.api within test_bug_1831771
This test would previously only attempt to invoke a race between instance.save(expected_task_state=task_states.SPAWNING) and a parallel attempt to delete an instance when the instance also has a vm_state of ACTIVE and task_state of None. However vm_state and task_state would often be different within the test resulting in no attempt to invoke the test being made. As instance.save is only called with expected_task_state set to task_states.SPAWNING by _unshelve_instance and _build_and_run_instance we should just check for this and avoid any state races within the test. Additionally when attempting to invoke the race this test would call _wait_for_server_parameter and provide self.api. This change removes this argument as since I8c96b337f32148f8f5899c9b87af331b1fa41424 this is no longer required and will result in a `TypeError: 'TestOpenStackClient' object is not subscriptable` error. Closes-Bug: #1866072 Change-Id: I36da36cc5b099174eece0dfba29485fc20b2867b
This commit is contained in:
parent
5aa8df8f5c
commit
cbffac7df1
|
@ -32,7 +32,6 @@ class TestDelete(integrated_helpers.ProviderUsageBaseTestCase):
|
|||
def delete_race(instance):
|
||||
self.api.delete_server(instance.uuid)
|
||||
self._wait_for_server_parameter(
|
||||
self.api,
|
||||
{'id': instance.uuid},
|
||||
{'OS-EXT-STS:task_state': task_states.DELETING},
|
||||
)
|
||||
|
@ -60,8 +59,6 @@ class TestDelete(integrated_helpers.ProviderUsageBaseTestCase):
|
|||
# the previous instance.save()
|
||||
expected_task_state = wrap_kwargs.get('expected_task_state')
|
||||
if (
|
||||
instance.vm_state == vm_states.ACTIVE and
|
||||
instance.task_state is None and
|
||||
expected_task_state == task_states.SPAWNING
|
||||
):
|
||||
delete_race(instance)
|
||||
|
|
Loading…
Reference in New Issue