Use wait_for_status instead of wait_for_delete
The enhanced wait_for_status could handle 404 responce and deleted status to verify deletion of a kind of resource. Change-Id: I82da4ad782f64176f19b1411dfe9d5cd96b1eafa
This commit is contained in:
parent
dfbc09c2ce
commit
b5c966418c
@ -173,8 +173,10 @@ class CinderScenario(scenario.OpenStackScenario):
|
||||
:param volume: volume object
|
||||
"""
|
||||
volume.delete()
|
||||
bench_utils.wait_for_delete(
|
||||
bench_utils.wait_for_status(
|
||||
volume,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=bench_utils.get_from_manager(),
|
||||
timeout=CONF.benchmark.cinder_volume_delete_timeout,
|
||||
check_interval=CONF.benchmark.cinder_volume_delete_poll_interval
|
||||
@ -282,8 +284,10 @@ class CinderScenario(scenario.OpenStackScenario):
|
||||
:param snapshot: snapshot object
|
||||
"""
|
||||
snapshot.delete()
|
||||
bench_utils.wait_for_delete(
|
||||
bench_utils.wait_for_status(
|
||||
snapshot,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=bench_utils.get_from_manager(),
|
||||
timeout=CONF.benchmark.cinder_volume_delete_timeout,
|
||||
check_interval=CONF.benchmark.cinder_volume_delete_poll_interval
|
||||
@ -314,8 +318,10 @@ class CinderScenario(scenario.OpenStackScenario):
|
||||
:param backup: backup instance
|
||||
"""
|
||||
backup.delete()
|
||||
bench_utils.wait_for_delete(
|
||||
bench_utils.wait_for_status(
|
||||
backup,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=bench_utils.get_from_manager(),
|
||||
timeout=CONF.benchmark.cinder_volume_delete_timeout,
|
||||
check_interval=CONF.benchmark.cinder_volume_delete_poll_interval
|
||||
|
@ -120,8 +120,10 @@ class GlanceScenario(scenario.OpenStackScenario):
|
||||
:param image: Image object
|
||||
"""
|
||||
image.delete()
|
||||
utils.wait_for_delete(
|
||||
utils.wait_for_status(
|
||||
image,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=utils.get_from_manager(),
|
||||
timeout=CONF.benchmark.glance_image_delete_timeout,
|
||||
check_interval=CONF.benchmark.glance_image_delete_poll_interval)
|
||||
|
@ -212,8 +212,10 @@ class HeatScenario(scenario.OpenStackScenario):
|
||||
:param stack: stack object
|
||||
"""
|
||||
stack.delete()
|
||||
utils.wait_for_delete(
|
||||
utils.wait_for_status(
|
||||
stack,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=utils.get_from_manager(),
|
||||
timeout=CONF.benchmark.heat_stack_delete_timeout,
|
||||
check_interval=CONF.benchmark.heat_stack_delete_poll_interval)
|
||||
|
@ -106,8 +106,10 @@ class ManilaScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
share.delete()
|
||||
error_statuses = ("error_deleting", )
|
||||
utils.wait_for_delete(
|
||||
utils.wait_for_status(
|
||||
share,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=utils.get_from_manager(error_statuses),
|
||||
timeout=CONF.benchmark.manila_share_delete_timeout,
|
||||
check_interval=CONF.benchmark.manila_share_delete_poll_interval)
|
||||
@ -153,8 +155,10 @@ class ManilaScenario(scenario.OpenStackScenario):
|
||||
:param share_network: instance of :class:`ShareNetwork`.
|
||||
"""
|
||||
share_network.delete()
|
||||
utils.wait_for_delete(
|
||||
utils.wait_for_status(
|
||||
share_network,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=utils.get_from_manager(),
|
||||
timeout=CONF.benchmark.manila_share_delete_timeout,
|
||||
check_interval=CONF.benchmark.manila_share_delete_poll_interval)
|
||||
@ -224,8 +228,10 @@ class ManilaScenario(scenario.OpenStackScenario):
|
||||
:param security_service: instance of :class:`SecurityService`.
|
||||
"""
|
||||
security_service.delete()
|
||||
utils.wait_for_delete(
|
||||
utils.wait_for_status(
|
||||
security_service,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=utils.get_from_manager(),
|
||||
timeout=CONF.benchmark.manila_share_delete_timeout,
|
||||
check_interval=CONF.benchmark.manila_share_delete_poll_interval)
|
||||
|
@ -79,8 +79,10 @@ class MuranoScenario(scenario.OpenStackScenario):
|
||||
self.clients("murano").environments.delete(environment.id)
|
||||
|
||||
config = CONF.benchmark
|
||||
utils.wait_for_delete(
|
||||
utils.wait_for_status(
|
||||
environment,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=utils.get_from_manager(),
|
||||
timeout=config.murano_delete_environment_timeout,
|
||||
check_interval=config.murano_delete_environment_check_interval
|
||||
|
@ -390,8 +390,10 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
else:
|
||||
server.delete()
|
||||
|
||||
utils.wait_for_delete(
|
||||
utils.wait_for_status(
|
||||
server,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=utils.get_from_manager(),
|
||||
timeout=CONF.benchmark.nova_server_delete_timeout,
|
||||
check_interval=CONF.benchmark.nova_server_delete_poll_interval
|
||||
@ -412,8 +414,10 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
server.delete()
|
||||
|
||||
for server in servers:
|
||||
utils.wait_for_delete(
|
||||
utils.wait_for_status(
|
||||
server,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=utils.get_from_manager(),
|
||||
timeout=CONF.benchmark.nova_server_delete_timeout,
|
||||
check_interval=CONF.
|
||||
@ -430,8 +434,10 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
"""
|
||||
image.delete()
|
||||
check_interval = CONF.benchmark.nova_server_image_delete_poll_interval
|
||||
utils.wait_for_delete(
|
||||
utils.wait_for_status(
|
||||
image,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=utils.get_from_manager(),
|
||||
timeout=CONF.benchmark.nova_server_image_delete_timeout,
|
||||
check_interval=check_interval
|
||||
|
@ -192,8 +192,10 @@ class NovaNetworkWrapper(NetworkWrapper):
|
||||
self.client.floating_ips.delete(fip_id)
|
||||
if not wait:
|
||||
return
|
||||
task_utils.wait_for_delete(
|
||||
task_utils.wait_for_status(
|
||||
fip_id,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=lambda i: self._get_floating_ip(i, do_raise=True))
|
||||
|
||||
def supports_extension(self, extension):
|
||||
|
@ -142,8 +142,10 @@ class CinderScenarioTestCase(test.ScenarioTestCase):
|
||||
cinder = mock.Mock()
|
||||
self.scenario._delete_volume(cinder)
|
||||
cinder.delete.assert_called_once_with()
|
||||
self.mock_wait_for_delete.mock.assert_called_once_with(
|
||||
self.mock_wait_for_status.mock.assert_called_once_with(
|
||||
cinder,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=self.mock_get_from_manager.mock.return_value,
|
||||
timeout=cfg.CONF.benchmark.cinder_volume_create_timeout,
|
||||
check_interval=cfg.CONF.benchmark
|
||||
@ -244,8 +246,10 @@ class CinderScenarioTestCase(test.ScenarioTestCase):
|
||||
snapshot = mock.Mock()
|
||||
self.scenario._delete_snapshot(snapshot)
|
||||
snapshot.delete.assert_called_once_with()
|
||||
self.mock_wait_for_delete.mock.assert_called_once_with(
|
||||
self.mock_wait_for_status.mock.assert_called_once_with(
|
||||
snapshot,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=self.mock_get_from_manager.mock.return_value,
|
||||
timeout=cfg.CONF.benchmark.cinder_volume_create_timeout,
|
||||
check_interval=cfg.CONF.benchmark
|
||||
@ -274,8 +278,10 @@ class CinderScenarioTestCase(test.ScenarioTestCase):
|
||||
backup = mock.Mock()
|
||||
self.scenario._delete_backup(backup)
|
||||
backup.delete.assert_called_once_with()
|
||||
self.mock_wait_for_delete.mock.assert_called_once_with(
|
||||
self.mock_wait_for_status.mock.assert_called_once_with(
|
||||
backup,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=self.mock_get_from_manager.mock.return_value,
|
||||
timeout=cfg.CONF.benchmark.cinder_volume_create_timeout,
|
||||
check_interval=cfg.CONF.benchmark
|
||||
|
@ -81,8 +81,10 @@ class GlanceScenarioTestCase(test.ScenarioTestCase):
|
||||
scenario = utils.GlanceScenario(context=self.context)
|
||||
scenario._delete_image(self.image)
|
||||
self.image.delete.assert_called_once_with()
|
||||
self.mock_wait_for_delete.mock.assert_called_once_with(
|
||||
self.mock_wait_for_status.mock.assert_called_once_with(
|
||||
self.image,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=self.mock_get_from_manager.mock.return_value,
|
||||
check_interval=CONF.benchmark.glance_image_delete_poll_interval,
|
||||
timeout=CONF.benchmark.glance_image_delete_timeout)
|
||||
|
@ -113,8 +113,10 @@ class HeatScenarioTestCase(test.ScenarioTestCase):
|
||||
scenario = utils.HeatScenario(self.context)
|
||||
scenario._delete_stack(self.stack)
|
||||
self.stack.delete.assert_called_once_with()
|
||||
self.mock_wait_for_delete.mock.assert_called_once_with(
|
||||
self.mock_wait_for_status.mock.assert_called_once_with(
|
||||
self.stack,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=self.mock_get_from_manager.mock.return_value,
|
||||
check_interval=CONF.benchmark.heat_stack_delete_poll_interval,
|
||||
timeout=CONF.benchmark.heat_stack_delete_timeout)
|
||||
|
@ -60,15 +60,17 @@ class ManilaScenarioTestCase(test.ScenarioTestCase):
|
||||
self.mock_resource_is.mock.assert_called_once_with("available")
|
||||
self.mock_get_from_manager.mock.assert_called_once_with()
|
||||
|
||||
@mock.patch(BM_UTILS + "wait_for_delete")
|
||||
def test__delete_share(self, mock_wait_for_delete):
|
||||
@mock.patch(BM_UTILS + "wait_for_status")
|
||||
def test__delete_share(self, mock_wait_for_status):
|
||||
fake_share = mock.MagicMock()
|
||||
|
||||
self.scenario._delete_share(fake_share)
|
||||
|
||||
fake_share.delete.assert_called_once_with()
|
||||
mock_wait_for_delete.assert_called_once_with(
|
||||
mock_wait_for_status.assert_called_once_with(
|
||||
fake_share,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=self.mock_get_from_manager.mock.return_value,
|
||||
timeout=180, check_interval=2)
|
||||
self.mock_get_from_manager.mock.assert_called_once_with(
|
||||
@ -110,15 +112,17 @@ class ManilaScenarioTestCase(test.ScenarioTestCase):
|
||||
self.clients("manila").share_networks.create.assert_called_once_with(
|
||||
**data)
|
||||
|
||||
@mock.patch(BM_UTILS + "wait_for_delete")
|
||||
def test__delete_share_network(self, mock_wait_for_delete):
|
||||
@mock.patch(BM_UTILS + "wait_for_status")
|
||||
def test__delete_share_network(self, mock_wait_for_status):
|
||||
fake_sn = mock.MagicMock()
|
||||
|
||||
self.scenario._delete_share_network(fake_sn)
|
||||
|
||||
fake_sn.delete.assert_called_once_with()
|
||||
mock_wait_for_delete.assert_called_once_with(
|
||||
mock_wait_for_status.assert_called_once_with(
|
||||
fake_sn,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=self.mock_get_from_manager.mock.return_value,
|
||||
timeout=180, check_interval=2)
|
||||
self.mock_get_from_manager.mock.assert_called_once_with()
|
||||
@ -182,15 +186,17 @@ class ManilaScenarioTestCase(test.ScenarioTestCase):
|
||||
"manila").security_services.create.assert_called_once_with(
|
||||
**expected)
|
||||
|
||||
@mock.patch(BM_UTILS + "wait_for_delete")
|
||||
def test__delete_security_service(self, mock_wait_for_delete):
|
||||
@mock.patch(BM_UTILS + "wait_for_status")
|
||||
def test__delete_security_service(self, mock_wait_for_status):
|
||||
fake_ss = mock.MagicMock()
|
||||
|
||||
self.scenario._delete_security_service(fake_ss)
|
||||
|
||||
fake_ss.delete.assert_called_once_with()
|
||||
mock_wait_for_delete.assert_called_once_with(
|
||||
mock_wait_for_status.assert_called_once_with(
|
||||
fake_ss,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=self.mock_get_from_manager.mock.return_value,
|
||||
timeout=180, check_interval=2)
|
||||
self.mock_get_from_manager.mock.assert_called_once_with()
|
||||
|
@ -53,8 +53,10 @@ class MuranoScenarioTestCase(test.ScenarioTestCase):
|
||||
)
|
||||
|
||||
config = CONF.benchmark
|
||||
self.mock_wait_for_delete.mock.assert_called_once_with(
|
||||
self.mock_wait_for_status.mock.assert_called_once_with(
|
||||
environment,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=self.mock_get_from_manager.mock.return_value,
|
||||
timeout=config.murano_delete_environment_timeout,
|
||||
check_interval=config.murano_delete_environment_check_interval)
|
||||
|
@ -258,8 +258,10 @@ class NovaScenarioTestCase(test.ScenarioTestCase):
|
||||
nova_scenario = utils.NovaScenario(context=self.context)
|
||||
nova_scenario._delete_server(self.server)
|
||||
self.server.delete.assert_called_once_with()
|
||||
self.mock_wait_for_delete.mock.assert_called_once_with(
|
||||
self.mock_wait_for_status.mock.assert_called_once_with(
|
||||
self.server,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=self.mock_get_from_manager.mock.return_value,
|
||||
check_interval=CONF.benchmark.nova_server_delete_poll_interval,
|
||||
timeout=CONF.benchmark.nova_server_delete_timeout)
|
||||
@ -271,8 +273,10 @@ class NovaScenarioTestCase(test.ScenarioTestCase):
|
||||
nova_scenario = utils.NovaScenario(context=self.context)
|
||||
nova_scenario._delete_server(self.server, force=True)
|
||||
self.server.force_delete.assert_called_once_with()
|
||||
self.mock_wait_for_delete.mock.assert_called_once_with(
|
||||
self.mock_wait_for_status.mock.assert_called_once_with(
|
||||
self.server,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=self.mock_get_from_manager.mock.return_value,
|
||||
check_interval=CONF.benchmark.nova_server_delete_poll_interval,
|
||||
timeout=CONF.benchmark.nova_server_delete_timeout)
|
||||
@ -394,6 +398,8 @@ class NovaScenarioTestCase(test.ScenarioTestCase):
|
||||
for server in servers:
|
||||
expected.append(mock.call(
|
||||
server,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=self.mock_get_from_manager.mock.return_value,
|
||||
check_interval=check_interval,
|
||||
timeout=CONF.benchmark.nova_server_delete_timeout))
|
||||
@ -404,7 +410,7 @@ class NovaScenarioTestCase(test.ScenarioTestCase):
|
||||
server.delete.assert_called_once_with()
|
||||
self.assertFalse(server.force_delete.called)
|
||||
|
||||
self.mock_wait_for_delete.mock.assert_has_calls(expected)
|
||||
self.mock_wait_for_status.mock.assert_has_calls(expected)
|
||||
timer_name = "nova.%sdelete_servers" % ("force_" if force else "")
|
||||
self._test_atomic_action_timer(nova_scenario.atomic_actions(),
|
||||
timer_name)
|
||||
@ -419,8 +425,10 @@ class NovaScenarioTestCase(test.ScenarioTestCase):
|
||||
nova_scenario = utils.NovaScenario(context=self.context)
|
||||
nova_scenario._delete_image(self.image)
|
||||
self.image.delete.assert_called_once_with()
|
||||
self.mock_wait_for_delete.mock.assert_called_once_with(
|
||||
self.mock_wait_for_status.mock.assert_called_once_with(
|
||||
self.image,
|
||||
ready_statuses=["deleted"],
|
||||
check_deletion=True,
|
||||
update_resource=self.mock_get_from_manager.mock.return_value,
|
||||
check_interval=CONF.benchmark.
|
||||
nova_server_image_delete_poll_interval,
|
||||
|
@ -110,10 +110,13 @@ class ScenarioTestCase(TestCase):
|
||||
self.benchmark_utils + ".wait_for")
|
||||
self.mock_wait_for_delete = mockpatch.Patch(
|
||||
self.benchmark_utils + ".wait_for_delete")
|
||||
self.mock_wait_for_status = mockpatch.Patch(
|
||||
self.benchmark_utils + ".wait_for_status")
|
||||
self.useFixture(self.mock_resource_is)
|
||||
self.useFixture(self.mock_get_from_manager)
|
||||
self.useFixture(self.mock_wait_for)
|
||||
self.useFixture(self.mock_wait_for_delete)
|
||||
self.useFixture(self.mock_wait_for_status)
|
||||
|
||||
self.mock_sleep = mockpatch.Patch("time.sleep")
|
||||
self.useFixture(self.mock_sleep)
|
||||
|
Loading…
Reference in New Issue
Block a user