From b16ab3f48a5909e1dfd9febdf31de9283f128308 Mon Sep 17 00:00:00 2001 From: Thomas Herve Date: Mon, 18 Aug 2014 17:52:41 -0400 Subject: [PATCH] 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 --- heat/tests/test_autoscaling_update_policy.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/heat/tests/test_autoscaling_update_policy.py b/heat/tests/test_autoscaling_update_policy.py index 15f920637..ecea89fe9 100644 --- a/heat/tests/test_autoscaling_update_policy.py +++ b/heat/tests/test_autoscaling_update_policy.py @@ -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):