Merge "Retrigger new traversals after resource timeout"

This commit is contained in:
Zuul 2017-10-23 07:08:34 +00:00 committed by Gerrit Code Review
commit 7858ae0a85
3 changed files with 15 additions and 8 deletions

View File

@ -151,11 +151,8 @@ class CheckResource(object):
self._handle_resource_failure(cnxt, is_update, rsrc.id,
stack, reason)
except scheduler.Timeout:
# reload the stack to verify current traversal
stack = parser.Stack.load(cnxt, stack_id=stack.id)
if stack.current_traversal != current_traversal:
return
self._handle_stack_timeout(cnxt, stack)
self._handle_resource_failure(cnxt, is_update, rsrc.id,
stack, u'Timed out')
except CancelOperation:
pass

View File

@ -476,15 +476,15 @@ class CheckWorkflowUpdateTest(common.HeatTestCase):
mock_hf.assert_called_once_with(self.ctx, self.stack, u'Timed out')
@mock.patch.object(check_resource.CheckResource,
'_handle_stack_timeout')
'_handle_failure')
def test_do_check_resource_marks_stack_as_failed_if_stack_timesout(
self, mock_hst, mock_cru, mock_crc, mock_pcr, mock_csc):
self, mock_hf, mock_cru, mock_crc, mock_pcr, mock_csc):
mock_cru.side_effect = scheduler.Timeout(None, 60)
self.is_update = True
self.cr._do_check_resource(self.ctx, self.stack.current_traversal,
self.stack.t, {}, self.is_update,
self.resource, self.stack, {})
mock_hst.assert_called_once_with(self.ctx, self.stack)
mock_hf.assert_called_once_with(self.ctx, self.stack, u'Timed out')
@mock.patch.object(check_resource.CheckResource,
'_handle_stack_timeout')

View File

@ -81,3 +81,13 @@ class SimultaneousUpdateStackTest(functional_base.FunctionalTestsBase):
time.sleep(10)
self.update_stack(stack_id, after)
@test.requires_convergence
def test_retrigger_timeout(self):
before, after = get_templates(delay_s=70)
stack_id = self.stack_create(template=before,
expected_status='CREATE_IN_PROGRESS',
timeout=1)
time.sleep(50)
self.update_stack(stack_id, after)