summaryrefslogtreecommitdiffstats
path: root/yardstick
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-02-17 19:01:36 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-02-17 19:01:36 +0000
commit5ea891398c0f7404d568bbe813100b2488d677ed (patch)
tree65b0f453e42193db1f40c5cc861fe27bea24a7a9 /yardstick
parent215740df982263cf3e2ae6581792856c365f0481 (diff)
parent009140f8947fc42f4d049c6d414ad7b18f32be35 (diff)
Merge "Workaround to fix Heat stack deletion bug in Shade"
Diffstat (limited to 'yardstick')
-rw-r--r--yardstick/orchestrator/heat.py9
-rw-r--r--yardstick/tests/unit/orchestrator/test_heat.py12
2 files changed, 20 insertions, 1 deletions
diff --git a/yardstick/orchestrator/heat.py b/yardstick/orchestrator/heat.py
index 754482e4f..558b5d2a6 100644
--- a/yardstick/orchestrator/heat.py
+++ b/yardstick/orchestrator/heat.py
@@ -74,7 +74,14 @@ class HeatStack(object):
if self.uuid is None:
return
- ret = self._cloud.delete_stack(self.uuid, wait=wait)
+ try:
+ ret = self._cloud.delete_stack(self.uuid, wait=wait)
+ except TypeError:
+ # NOTE(ralonsoh): this exception catch solves a bug in Shade, which
+ # tries to retrieve and read the stack status when it's already
+ # deleted.
+ ret = True
+
_DEPLOYED_STACKS.pop(self.uuid)
self._stack = None
return ret
diff --git a/yardstick/tests/unit/orchestrator/test_heat.py b/yardstick/tests/unit/orchestrator/test_heat.py
index f53c9b78c..e0a353812 100644
--- a/yardstick/tests/unit/orchestrator/test_heat.py
+++ b/yardstick/tests/unit/orchestrator/test_heat.py
@@ -89,6 +89,18 @@ class HeatStackTestCase(unittest.TestCase):
self.assertFalse(heat._DEPLOYED_STACKS)
self.mock_stack_delete.assert_called_once_with(id, wait=True)
+ def test_delete_bug_in_shade(self):
+ id = uuidutils.generate_uuid()
+ self.heatstack._stack = FakeStack(
+ outputs=mock.Mock(), status=mock.Mock(), id=id)
+ heat._DEPLOYED_STACKS[id] = self.heatstack._stack
+ self.mock_stack_delete.side_effect = TypeError()
+
+ ret = self.heatstack.delete(wait=True)
+ self.assertTrue(ret)
+ self.assertFalse(heat._DEPLOYED_STACKS)
+ self.mock_stack_delete.assert_called_once_with(id, wait=True)
+
class HeatTemplateTestCase(unittest.TestCase):