@ -1340,59 +1340,12 @@ class StackServiceTest(common.HeatTestCase):
service_check_defer = True ,
resource_validate = False )
self . assertTrue ( lock2 . release . called )
reason = ( ' Engine went down during stack %s ' % fake_stack . action )
mock_thread . start_with_acquired_lock . assert_called_once_with (
fake_stack , lock1 ,
self . eng . set_stack_and_resource_to_failed , fake_stack
fake_stack . reset_stack_and_resources_in_progress , reason
)
def test_set_stack_and_resource_to_failed ( self ) :
def fake_stack ( ) :
stk = mock . MagicMock ( )
stk . action = ' CREATE '
stk . id = ' foo '
stk . status = ' IN_PROGRESS '
stk . FAILED = ' FAILED '
def mock_stack_state_set ( a , s , reason ) :
stk . status = s
stk . action = a
stk . status_reason = reason
stk . state_set = mock_stack_state_set
return stk
def fake_stack_resource ( name , action , status ) :
rs = mock . MagicMock ( )
rs . name = name
rs . action = action
rs . status = status
rs . IN_PROGRESS = ' IN_PROGRESS '
rs . FAILED = ' FAILED '
def mock_resource_state_set ( a , s , reason = ' engine_down ' ) :
rs . status = s
rs . action = a
rs . status_reason = reason
rs . state_set = mock_resource_state_set
return rs
test_stack = fake_stack ( )
test_stack . resources = {
' r1 ' : fake_stack_resource ( ' r1 ' , ' UPDATE ' , ' COMPLETE ' ) ,
' r2 ' : fake_stack_resource ( ' r2 ' , ' UPDATE ' , ' IN_PROGRESS ' ) ,
' r3 ' : fake_stack_resource ( ' r3 ' , ' UPDATE ' , ' FAILED ' ) }
self . eng . set_stack_and_resource_to_failed ( test_stack )
self . assertEqual ( ' FAILED ' , test_stack . status )
self . assertEqual ( ' COMPLETE ' , test_stack . resources . get ( ' r1 ' ) . status )
self . assertEqual ( ' FAILED ' , test_stack . resources . get ( ' r2 ' ) . status )
self . assertEqual ( ' FAILED ' , test_stack . resources . get ( ' r3 ' ) . status )
def test_parse_adopt_stack_data_without_parameters ( self ) :
cfg . CONF . set_override ( ' enable_stack_adopt ' , True , enforce_type = True )
template = { " heat_template_version " : " 2015-04-30 " ,