Merge "Skip resource counting during validation"
This commit is contained in:
commit
d899c240e4
|
@ -435,6 +435,9 @@ class Stack(collections.Mapping):
|
|||
Includes nested stacks below.
|
||||
"""
|
||||
if not stack_id:
|
||||
if not self.id:
|
||||
# We're not stored yet, so we don't have anything to count
|
||||
return 0
|
||||
stack_id = self.id
|
||||
return stack_object.Stack.count_total_resources(self.context, stack_id)
|
||||
|
||||
|
|
|
@ -206,6 +206,13 @@ class StackTest(common.HeatTestCase):
|
|||
self.assertEqual(0, self.stack.total_resources(self.stack.id))
|
||||
self.assertEqual(0, self.stack.total_resources())
|
||||
|
||||
@mock.patch.object(db_api, 'stack_count_total_resources')
|
||||
def test_total_resources_not_stored(self, sctr):
|
||||
self.stack = stack.Stack(self.ctx, 'test_stack', self.tmpl,
|
||||
status_reason='flimflam')
|
||||
self.assertEqual(0, self.stack.total_resources())
|
||||
sctr.assert_not_called()
|
||||
|
||||
def test_total_resources_not_found(self):
|
||||
self.stack = stack.Stack(self.ctx, 'test_stack', self.tmpl,
|
||||
status_reason='flimflam')
|
||||
|
|
Loading…
Reference in New Issue