From: Zane Bitter Date: Mon, 10 Dec 2012 13:47:17 +0000 (+0100) Subject: Don't pass -1 as a stack_id in unit tests X-Git-Tag: 2014.1~1100^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=7abb73f36b663818ffb1291f6e6912106377ed79;p=openstack-build%2Fheat-build.git Don't pass -1 as a stack_id in unit tests We now use UUIDs as stack IDs, but in most cases even that is not necessary. Change-Id: I0ef4efb5c3289c6c3d0fd3d0232118c0e906f8b5 Signed-off-by: Zane Bitter --- diff --git a/heat/tests/test_autoscaling.py b/heat/tests/test_autoscaling.py index a8c5c9fe..752310d3 100644 --- a/heat/tests/test_autoscaling.py +++ b/heat/tests/test_autoscaling.py @@ -57,8 +57,7 @@ class AutoScalingTest(unittest.TestCase): 'auth_url': 'http://localhost:5000/v2.0'}) template = parser.Template(t) params = parser.Parameters('test_stack', template, {'KeyName': 'test'}) - stack = parser.Stack(ctx, 'test_stack', template, - params, stack_id=-1) + stack = parser.Stack(ctx, 'test_stack', template, params) return stack diff --git a/heat/tests/test_dbinstance.py b/heat/tests/test_dbinstance.py index cdffbdab..c0dcc2d4 100644 --- a/heat/tests/test_dbinstance.py +++ b/heat/tests/test_dbinstance.py @@ -60,8 +60,7 @@ class DBInstanceTest(unittest.TestCase): 'auth_url': 'http://localhost:5000/v2.0'}) template = parser.Template(t) params = parser.Parameters('test_stack', template, {'KeyName': 'test'}) - stack = parser.Stack(ctx, 'test_stack', template, - params, stack_id=-1) + stack = parser.Stack(ctx, 'test_stack', template, params) return stack diff --git a/heat/tests/test_eip.py b/heat/tests/test_eip.py index be64db16..6203f573 100644 --- a/heat/tests/test_eip.py +++ b/heat/tests/test_eip.py @@ -60,8 +60,7 @@ class EIPTest(unittest.TestCase): 'auth_url': 'http://localhost:5000/v2.0'}) template = parser.Template(t) params = parser.Parameters('test_stack', template, {'KeyName': 'test'}) - stack = parser.Stack(ctx, 'test_stack', template, - params, stack_id=-1) + stack = parser.Stack(ctx, 'test_stack', template, params) return stack diff --git a/heat/tests/test_instance.py b/heat/tests/test_instance.py index 6465d265..34a3db12 100644 --- a/heat/tests/test_instance.py +++ b/heat/tests/test_instance.py @@ -30,6 +30,7 @@ from heat.engine.resources import instance as instances import heat.db as db_api from heat.common import template_format from heat.engine import parser +from heat.openstack.common import uuidutils @attr(tag=['unit', 'resource', 'instance']) @@ -53,8 +54,8 @@ class instancesTest(unittest.TestCase): stack_name = 'instance_create_test_stack' template = parser.Template(t) params = parser.Parameters(stack_name, template, {'KeyName': 'test'}) - stack = parser.Stack(None, stack_name, template, - params, stack_id=-1) + stack = parser.Stack(None, stack_name, template, params, + stack_id=uuidutils.generate_uuid()) t['Resources']['WebServer']['Properties']['ImageId'] = 'CentOS 5.2' t['Resources']['WebServer']['Properties']['InstanceType'] = \ @@ -92,8 +93,8 @@ class instancesTest(unittest.TestCase): stack_name = 'instance_create_delete_test_stack' template = parser.Template(t) params = parser.Parameters(stack_name, template, {'KeyName': 'test'}) - stack = parser.Stack(None, stack_name, template, - params, stack_id=-1) + stack = parser.Stack(None, stack_name, template, params, + stack_id=uuidutils.generate_uuid()) t['Resources']['WebServer']['Properties']['ImageId'] = 'CentOS 5.2' t['Resources']['WebServer']['Properties']['InstanceType'] = \ diff --git a/heat/tests/test_quantum.py b/heat/tests/test_quantum.py index 8c04931d..91c81736 100644 --- a/heat/tests/test_quantum.py +++ b/heat/tests/test_quantum.py @@ -82,8 +82,11 @@ class QuantumTest(unittest.TestCase): 'username': 'test_username', 'password': 'password', 'auth_url': 'http://localhost:5000/v2.0'}) - stack = parser.Stack(ctx, 'test_stack', parser.Template(t), - stack_id=-1, parameters={'external_network': 'abcd1234'}) + stack_name = 'test_stack' + tmpl = parser.Template(t) + params = parser.Parameters(stack_name, tmpl, + {'external_network': 'abcd1234'}) + stack = parser.Stack(ctx, stack_name, tmpl, params) return stack diff --git a/heat/tests/test_resource.py b/heat/tests/test_resource.py index 3eeadf30..68f6023a 100644 --- a/heat/tests/test_resource.py +++ b/heat/tests/test_resource.py @@ -22,6 +22,7 @@ import json from heat.common import context from heat.engine import parser from heat.engine import resource +from heat.openstack.common import uuidutils @attr(tag=['unit', 'resource']) @@ -29,7 +30,7 @@ from heat.engine import resource class ResourceTest(unittest.TestCase): def setUp(self): self.stack = parser.Stack(None, 'test_stack', parser.Template({}), - stack_id=-1) + stack_id=uuidutils.generate_uuid()) def test_state_defaults(self): tmpl = {'Type': 'Foo'} diff --git a/heat/tests/test_s3.py b/heat/tests/test_s3.py index 0842ba96..6577c0cd 100644 --- a/heat/tests/test_s3.py +++ b/heat/tests/test_s3.py @@ -69,8 +69,7 @@ class s3Test(unittest.TestCase): 'username': 'test_username', 'password': 'password', 'auth_url': 'http://localhost:5000/v2.0'}) - stack = parser.Stack(ctx, 'test_stack', parser.Template(t), - stack_id=-1) + stack = parser.Stack(ctx, 'test_stack', parser.Template(t)) return stack diff --git a/heat/tests/test_template_format.py b/heat/tests/test_template_format.py index d89d0428..aa05daee 100644 --- a/heat/tests/test_template_format.py +++ b/heat/tests/test_template_format.py @@ -117,10 +117,10 @@ class JsonYamlResolvedCompareTest(unittest.TestCase): 'username': 'test_username', 'password': 'password', 'auth_url': 'http://localhost:5000/v2.0'}) + stack_name = 'test_stack' template = parser.Template(t) - params = parser.Parameters('test_stack', template, parameters) - stack = parser.Stack(ctx, 'test_stack', parser.Template(t), - stack_id=-1, parameters=params) + params = parser.Parameters(stack_name, template, parameters) + stack = parser.Stack(ctx, stack_name, parser.Template(t), params) return stack diff --git a/heat/tests/test_user.py b/heat/tests/test_user.py index 780d5a1d..f76e2d0d 100644 --- a/heat/tests/test_user.py +++ b/heat/tests/test_user.py @@ -66,8 +66,7 @@ class UserTest(unittest.TestCase): 'DBRootPassword': 'test', 'DBUsername': 'test', 'DBPassword': 'test'}) - stack = parser.Stack(ctx, 'test_stack', template, - params, stack_id=-1) + stack = parser.Stack(ctx, 'test_stack', template, params) return stack diff --git a/heat/tests/test_vpc.py b/heat/tests/test_vpc.py index 447a34cb..314c9b36 100644 --- a/heat/tests/test_vpc.py +++ b/heat/tests/test_vpc.py @@ -80,8 +80,11 @@ class QuantumTest(unittest.TestCase): 'username': 'test_username', 'password': 'password', 'auth_url': 'http://localhost:5000/v2.0'}) - stack = parser.Stack(ctx, 'test_stack', parser.Template(t), - stack_id=-1, parameters={'external_network': 'abcd1234'}) + stack_name = 'test_stack' + tmpl = parser.Template(t) + params = parser.Parameters(stack_name, tmpl, + {'external_network': 'abcd1234'}) + stack = parser.Stack(ctx, stack_name, tmpl, params) return stack