From 78d56b1e0d33d1c8b843f414e25c82cd12e18820 Mon Sep 17 00:00:00 2001 From: Anant Patil Date: Fri, 19 Aug 2016 19:00:58 +0530 Subject: [PATCH] Convergence: fix input to check_stack_complete The input to check stack complete should be the resource ID of the resource that the current resource replaces instead of its own. Failing to do so will result in stack being in in_progress state for ever. Change-Id: I6f2856c82c8cc73f628976b7296ab0fb20af5ff3 Closes-Bug: #1614960 --- heat/engine/check_resource.py | 2 +- heat/tests/engine/test_check_resource.py | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/heat/engine/check_resource.py b/heat/engine/check_resource.py index d0b839b404..5b8ac4024b 100644 --- a/heat/engine/check_resource.py +++ b/heat/engine/check_resource.py @@ -206,7 +206,7 @@ class CheckResource(object): stack.adopt_stack_data) check_stack_complete(cnxt, stack, current_traversal, - resource_id, deps, is_update) + graph_key[0], deps, graph_key[1]) except exception.EntityNotFound as e: if e.entity == "Sync Point": # Reload the stack to determine the current traversal, and diff --git a/heat/tests/engine/test_check_resource.py b/heat/tests/engine/test_check_resource.py index 2c37fbea46..50b475f9aa 100644 --- a/heat/tests/engine/test_check_resource.py +++ b/heat/tests/engine/test_check_resource.py @@ -336,6 +336,26 @@ class CheckWorkflowUpdateTest(common.HeatTestCase): mock_rcr.assert_called_once_with(self.ctx, self.is_update, self.resource.id, updated_stack) + def test_check_stack_complete_is_invoked_for_replaced_resource( + self, mock_cru, mock_crc, mock_pcr, mock_csc, mock_cid): + resC = self.stack['C'] + # lets say C is update-replaced + is_update = True + replacementC_id = resC.make_replacement(self.stack.t.id) + replacementC, stack, _ = resource.Resource.load(self.ctx, + replacementC_id, + is_update, {}) + self.cr._initiate_propagate_resource(self.ctx, replacementC_id, + self.stack.current_traversal, + is_update, replacementC, + self.stack) + # check_stack_complete should be called with resC.id not + # replacementC.id + mock_csc.assert_called_once_with(self.ctx, self.stack, + self.stack.current_traversal, + resC.id, mock.ANY, + is_update) + @mock.patch.object(sync_point, 'sync') def test_retrigger_check_resource(self, mock_sync, mock_cru, mock_crc, mock_pcr, mock_csc, mock_cid):