Add some stubs speeding up test suite

Some recent changes added about 4 minutes to test runtime because some
validation was trying to connect to the outside and it took lots of time
for it to fail.

Change-Id: I88f64c698822c712a07021ffc653a01e67fb7d7b
This commit is contained in:
Thomas Herve 2014-08-18 17:52:41 -04:00
parent 1dfb9c880e
commit b16ab3f48a

View File

@ -13,6 +13,7 @@
import copy
import json
import six
import mox
from oslo.config import cfg
@ -367,17 +368,27 @@ class AutoScalingGroupTest(HeatTestCase):
self.m.VerifyAll()
def test_parse_with_bad_update_policy(self):
self.stub_ImageConstraint_validate()
self.stub_KeypairConstraint_validate()
self.m.ReplayAll()
tmpl = template_format.parse(asg_tmpl_with_bad_updt_policy)
stack = utils.parse_stack(tmpl)
self.assertRaises(exception.StackValidationFailed, stack.validate)
error = self.assertRaises(
exception.StackValidationFailed, stack.validate)
self.assertIn("foo", six.text_type(error))
def test_parse_with_bad_pausetime_in_update_policy(self):
self.stub_ImageConstraint_validate()
self.stub_KeypairConstraint_validate()
self.m.ReplayAll()
tmpl = template_format.parse(asg_tmpl_with_default_updt_policy)
group = tmpl['Resources']['WebServerGroup']
policy = group['UpdatePolicy']['AutoScalingRollingUpdate']
policy['PauseTime'] = 'P1YT1H'
stack = utils.parse_stack(tmpl)
self.assertRaises(exception.StackValidationFailed, stack.validate)
error = self.assertRaises(
exception.StackValidationFailed, stack.validate)
self.assertIn("Only ISO 8601 duration format", six.text_type(error))
def validate_update_policy_diff(self, current, updated):