@@ -1353,10 +1353,6 @@ def test_delete_fast_if_host_not_set(self, mock_br_get, mock_save,
1353
1353
self .context , instance_uuid , constraint = 'constraint' ,
1354
1354
hard_delete = False )
1355
1355
1356
- def _fake_do_delete (context , instance , bdms ,
1357
- reservations = None , local = False ):
1358
- pass
1359
-
1360
1356
@mock .patch .object (compute_utils , 'notify_about_instance_action' )
1361
1357
@mock .patch .object (objects .BlockDeviceMapping , 'destroy' )
1362
1358
@mock .patch .object (cinder .API , 'detach' )
@@ -1378,9 +1374,11 @@ def test_local_delete_with_deleted_volume(
1378
1374
mock_elevated .return_value = self .context
1379
1375
mock_detach .side_effect = exception .VolumeNotFound ('volume_id' )
1380
1376
1377
+ # lambda function is used to run no op call as a delete function
1378
+ # called by compute_api._local_delete
1381
1379
self .compute_api ._local_delete (self .context , inst , bdms ,
1382
1380
'delete' ,
1383
- self . _fake_do_delete )
1381
+ lambda * args , ** kwargs : None )
1384
1382
1385
1383
mock_notify_legacy .assert_has_calls ([
1386
1384
mock .call (self .compute_api .notifier , self .context ,
@@ -1416,8 +1414,11 @@ def test_local_delete_for_arqs(
1416
1414
inst ._context = self .context
1417
1415
mock_elevated .return_value = self .context
1418
1416
bdms = []
1417
+ # lambda function is used to run no op call as a delete function
1418
+ # called by compute_api._local_delete
1419
1419
self .compute_api ._local_delete (self .context , inst , bdms ,
1420
- 'delete' , self ._fake_do_delete )
1420
+ 'delete' ,
1421
+ lambda * args , ** kwargs : None )
1421
1422
mock_del_arqs .assert_called_once_with (self .context , inst )
1422
1423
1423
1424
@mock .patch .object (objects .BlockDeviceMapping , 'destroy' )
0 commit comments