@@ -1666,7 +1666,8 @@ def fake_set_provision_state(*_):
1666
1666
1667
1667
mock_node .get_by_instance_uuid .assert_called_with (
1668
1668
instance .uuid , fields = ironic_driver ._NODE_FIELDS )
1669
- mock_cleanup_deploy .assert_called_with (node , instance , network_info )
1669
+ mock_cleanup_deploy .assert_called_with (node , instance , network_info ,
1670
+ remove_instance_info = False )
1670
1671
1671
1672
# For states that makes sense check if set_provision_state has
1672
1673
# been called
@@ -1699,7 +1700,8 @@ def test_destroy_trigger_undeploy_fail(self, mock_clean, fake_validate,
1699
1700
mock_sps .side_effect = exception .NovaException ()
1700
1701
self .assertRaises (exception .NovaException , self .driver .destroy ,
1701
1702
self .ctx , instance , None , None )
1702
- mock_clean .assert_called_once_with (node , instance , None )
1703
+ mock_clean .assert_called_once_with (node , instance , None ,
1704
+ remove_instance_info = False )
1703
1705
1704
1706
@mock .patch .object (FAKE_CLIENT .node , 'update' )
1705
1707
@mock .patch .object (ironic_driver .IronicDriver ,
@@ -1718,7 +1720,8 @@ def test_destroy_trigger_remove_info_fail(self, mock_clean, fake_validate,
1718
1720
mock_update .side_effect = SystemError ('unexpected error' )
1719
1721
self .assertRaises (SystemError , self .driver .destroy ,
1720
1722
self .ctx , instance , None , None )
1721
- mock_clean .assert_called_once_with (node , instance , None )
1723
+ mock_clean .assert_called_once_with (node , instance , None ,
1724
+ remove_instance_info = False )
1722
1725
1723
1726
@mock .patch .object (FAKE_CLIENT .node , 'set_provision_state' )
1724
1727
@mock .patch .object (ironic_driver .IronicDriver ,
@@ -2549,6 +2552,24 @@ def test__cleanup_deploy(self, mock_call, mock_vol, mock_unvif,
2549
2552
mock_call .has_calls (
2550
2553
[mock .call ('node.update' , node .uuid , expected_patch )])
2551
2554
2555
+ @mock .patch .object (ironic_driver .IronicDriver , '_stop_firewall' )
2556
+ @mock .patch .object (ironic_driver .IronicDriver , '_unplug_vifs' )
2557
+ @mock .patch .object (ironic_driver .IronicDriver ,
2558
+ '_cleanup_volume_target_info' )
2559
+ @mock .patch .object (cw .IronicClientWrapper , 'call' )
2560
+ def test__cleanup_deploy_no_remove_ii (self , mock_call , mock_vol ,
2561
+ mock_unvif , mock_stop_fw ):
2562
+ # TODO(TheJulia): This REALLY should be updated to cover all of the
2563
+ # calls that take place.
2564
+ node = ironic_utils .get_test_node (driver = 'fake' )
2565
+ instance = fake_instance .fake_instance_obj (self .ctx ,
2566
+ node = node .uuid )
2567
+ self .driver ._cleanup_deploy (node , instance , remove_instance_info = False )
2568
+ mock_vol .assert_called_once_with (instance )
2569
+ mock_unvif .assert_called_once_with (node , instance , None )
2570
+ mock_stop_fw .assert_called_once_with (instance , None )
2571
+ self .assertFalse (mock_call .called )
2572
+
2552
2573
2553
2574
class IronicDriverSyncTestCase (IronicDriverTestCase ):
2554
2575
0 commit comments