Merge "Unit tests: Don't use ResourceDefinition as cfn snippet"
This commit is contained in:
commit
69874fc384
@ -96,9 +96,10 @@ class DockerContainerTest(common.HeatTestCase):
|
|||||||
t = template_format.parse(template)
|
t = template_format.parse(template)
|
||||||
self.stack = utils.parse_stack(t)
|
self.stack = utils.parse_stack(t)
|
||||||
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
||||||
definition['Properties']['name'] = 'super-blog'
|
props = t['Resources']['Blog']['Properties'].copy()
|
||||||
|
props['name'] = 'super-blog'
|
||||||
resource = docker_container.DockerContainer(
|
resource = docker_container.DockerContainer(
|
||||||
'Blog', definition, self.stack)
|
'Blog', definition.freeze(properties=props), self.stack)
|
||||||
self.m.StubOutWithMock(resource, 'get_client')
|
self.m.StubOutWithMock(resource, 'get_client')
|
||||||
resource.get_client().MultipleTimes().AndReturn(
|
resource.get_client().MultipleTimes().AndReturn(
|
||||||
docker.Client())
|
docker.Client())
|
||||||
@ -136,11 +137,11 @@ class DockerContainerTest(common.HeatTestCase):
|
|||||||
t = template_format.parse(template)
|
t = template_format.parse(template)
|
||||||
self.stack = utils.parse_stack(t)
|
self.stack = utils.parse_stack(t)
|
||||||
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
||||||
definition['Properties']['port_bindings'] = {
|
props = t['Resources']['Blog']['Properties'].copy()
|
||||||
'80/tcp': [{'HostPort': '80'}]}
|
props['port_bindings'] = {'80/tcp': [{'HostPort': '80'}]}
|
||||||
definition['Properties']['links'] = {'db': 'mysql'}
|
props['links'] = {'db': 'mysql'}
|
||||||
resource = docker_container.DockerContainer(
|
resource = docker_container.DockerContainer(
|
||||||
'Blog', definition, self.stack)
|
'Blog', definition.freeze(properties=props), self.stack)
|
||||||
self.m.StubOutWithMock(resource, 'get_client')
|
self.m.StubOutWithMock(resource, 'get_client')
|
||||||
resource.get_client().MultipleTimes().AndReturn(
|
resource.get_client().MultipleTimes().AndReturn(
|
||||||
docker.Client())
|
docker.Client())
|
||||||
@ -228,10 +229,10 @@ class DockerContainerTest(common.HeatTestCase):
|
|||||||
t = template_format.parse(template)
|
t = template_format.parse(template)
|
||||||
self.stack = utils.parse_stack(t)
|
self.stack = utils.parse_stack(t)
|
||||||
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
||||||
definition['Properties']['restart_policy'] = {
|
props = t['Resources']['Blog']['Properties'].copy()
|
||||||
'Name': 'no', 'MaximumRetryCount': 0}
|
props['restart_policy'] = {'Name': 'no', 'MaximumRetryCount': 0}
|
||||||
resource = docker_container.DockerContainer(
|
resource = docker_container.DockerContainer(
|
||||||
'Blog', definition, self.stack)
|
'Blog', definition.freeze(properties=props), self.stack)
|
||||||
get_client_mock = self.patchobject(resource, 'get_client')
|
get_client_mock = self.patchobject(resource, 'get_client')
|
||||||
get_client_mock.return_value = docker.Client()
|
get_client_mock.return_value = docker.Client()
|
||||||
self.assertIsNone(resource.validate())
|
self.assertIsNone(resource.validate())
|
||||||
@ -247,10 +248,11 @@ class DockerContainerTest(common.HeatTestCase):
|
|||||||
t = template_format.parse(template)
|
t = template_format.parse(template)
|
||||||
self.stack = utils.parse_stack(t)
|
self.stack = utils.parse_stack(t)
|
||||||
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
||||||
definition['Properties']['restart_policy'] = {
|
props = t['Resources']['Blog']['Properties'].copy()
|
||||||
'Name': 'on-failure', 'MaximumRetryCount': 10}
|
props['restart_policy'] = {'Name': 'on-failure',
|
||||||
|
'MaximumRetryCount': 10}
|
||||||
resource = docker_container.DockerContainer(
|
resource = docker_container.DockerContainer(
|
||||||
'Blog', definition, self.stack)
|
'Blog', definition.freeze(properties=props), self.stack)
|
||||||
get_client_mock = self.patchobject(resource, 'get_client')
|
get_client_mock = self.patchobject(resource, 'get_client')
|
||||||
get_client_mock.return_value = docker.Client()
|
get_client_mock.return_value = docker.Client()
|
||||||
self.assertIsNone(resource.validate())
|
self.assertIsNone(resource.validate())
|
||||||
@ -266,10 +268,10 @@ class DockerContainerTest(common.HeatTestCase):
|
|||||||
t = template_format.parse(template)
|
t = template_format.parse(template)
|
||||||
self.stack = utils.parse_stack(t)
|
self.stack = utils.parse_stack(t)
|
||||||
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
||||||
definition['Properties']['restart_policy'] = {
|
props = t['Resources']['Blog']['Properties'].copy()
|
||||||
'Name': 'always', 'MaximumRetryCount': 0}
|
props['restart_policy'] = {'Name': 'always', 'MaximumRetryCount': 0}
|
||||||
resource = docker_container.DockerContainer(
|
resource = docker_container.DockerContainer(
|
||||||
'Blog', definition, self.stack)
|
'Blog', definition.freeze(properties=props), self.stack)
|
||||||
get_client_mock = self.patchobject(resource, 'get_client')
|
get_client_mock = self.patchobject(resource, 'get_client')
|
||||||
get_client_mock.return_value = docker.Client()
|
get_client_mock.return_value = docker.Client()
|
||||||
self.assertIsNone(resource.validate())
|
self.assertIsNone(resource.validate())
|
||||||
@ -285,10 +287,11 @@ class DockerContainerTest(common.HeatTestCase):
|
|||||||
t = template_format.parse(template)
|
t = template_format.parse(template)
|
||||||
self.stack = utils.parse_stack(t)
|
self.stack = utils.parse_stack(t)
|
||||||
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
||||||
definition['Properties']['cap_add'] = ['NET_ADMIN']
|
props = t['Resources']['Blog']['Properties'].copy()
|
||||||
definition['Properties']['cap_drop'] = ['MKNOD']
|
props['cap_add'] = ['NET_ADMIN']
|
||||||
|
props['cap_drop'] = ['MKNOD']
|
||||||
resource = docker_container.DockerContainer(
|
resource = docker_container.DockerContainer(
|
||||||
'Blog', definition, self.stack)
|
'Blog', definition.freeze(properties=props), self.stack)
|
||||||
get_client_mock = self.patchobject(resource, 'get_client')
|
get_client_mock = self.patchobject(resource, 'get_client')
|
||||||
get_client_mock.return_value = docker.Client()
|
get_client_mock.return_value = docker.Client()
|
||||||
self.assertIsNone(resource.validate())
|
self.assertIsNone(resource.validate())
|
||||||
@ -304,9 +307,10 @@ class DockerContainerTest(common.HeatTestCase):
|
|||||||
t = template_format.parse(template)
|
t = template_format.parse(template)
|
||||||
self.stack = utils.parse_stack(t)
|
self.stack = utils.parse_stack(t)
|
||||||
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
||||||
definition['Properties']['read_only'] = True
|
props = t['Resources']['Blog']['Properties'].copy()
|
||||||
|
props['read_only'] = True
|
||||||
resource = docker_container.DockerContainer(
|
resource = docker_container.DockerContainer(
|
||||||
'Blog', definition, self.stack)
|
'Blog', definition.freeze(properties=props), self.stack)
|
||||||
get_client_mock = self.patchobject(resource, 'get_client')
|
get_client_mock = self.patchobject(resource, 'get_client')
|
||||||
get_client_mock.return_value = docker.Client()
|
get_client_mock.return_value = docker.Client()
|
||||||
get_client_mock.return_value.set_api_version('1.17')
|
get_client_mock.return_value.set_api_version('1.17')
|
||||||
@ -322,9 +326,10 @@ class DockerContainerTest(common.HeatTestCase):
|
|||||||
t = template_format.parse(template)
|
t = template_format.parse(template)
|
||||||
self.stack = utils.parse_stack(t)
|
self.stack = utils.parse_stack(t)
|
||||||
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
||||||
definition['Properties'][arg] = value
|
props = t['Resources']['Blog']['Properties'].copy()
|
||||||
|
props[arg] = value
|
||||||
my_resource = docker_container.DockerContainer(
|
my_resource = docker_container.DockerContainer(
|
||||||
'Blog', definition, self.stack)
|
'Blog', definition.freeze(properties=props), self.stack)
|
||||||
get_client_mock = self.patchobject(my_resource, 'get_client')
|
get_client_mock = self.patchobject(my_resource, 'get_client')
|
||||||
get_client_mock.return_value = docker.Client()
|
get_client_mock.return_value = docker.Client()
|
||||||
get_client_mock.return_value.set_api_version(low_version)
|
get_client_mock.return_value.set_api_version(low_version)
|
||||||
@ -348,9 +353,10 @@ class DockerContainerTest(common.HeatTestCase):
|
|||||||
t = template_format.parse(template)
|
t = template_format.parse(template)
|
||||||
self.stack = utils.parse_stack(t)
|
self.stack = utils.parse_stack(t)
|
||||||
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
||||||
definition['Properties']['cpu_shares'] = 512
|
props = t['Resources']['Blog']['Properties'].copy()
|
||||||
|
props['cpu_shares'] = 512
|
||||||
my_resource = docker_container.DockerContainer(
|
my_resource = docker_container.DockerContainer(
|
||||||
'Blog', definition, self.stack)
|
'Blog', definition.freeze(properties=props), self.stack)
|
||||||
get_client_mock = self.patchobject(my_resource, 'get_client')
|
get_client_mock = self.patchobject(my_resource, 'get_client')
|
||||||
get_client_mock.return_value = docker.Client()
|
get_client_mock.return_value = docker.Client()
|
||||||
self.assertIsNone(my_resource.validate())
|
self.assertIsNone(my_resource.validate())
|
||||||
@ -368,7 +374,8 @@ class DockerContainerTest(common.HeatTestCase):
|
|||||||
t = template_format.parse(template)
|
t = template_format.parse(template)
|
||||||
self.stack = utils.parse_stack(t)
|
self.stack = utils.parse_stack(t)
|
||||||
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
||||||
definition['Properties']['devices'] = (
|
props = t['Resources']['Blog']['Properties'].copy()
|
||||||
|
props['devices'] = (
|
||||||
[{'path_on_host': '/dev/sda',
|
[{'path_on_host': '/dev/sda',
|
||||||
'path_in_container': '/dev/xvdc',
|
'path_in_container': '/dev/xvdc',
|
||||||
'permissions': 'r'},
|
'permissions': 'r'},
|
||||||
@ -376,7 +383,7 @@ class DockerContainerTest(common.HeatTestCase):
|
|||||||
'path_in_container': '/dev/xvdd',
|
'path_in_container': '/dev/xvdd',
|
||||||
'permissions': 'rw'}])
|
'permissions': 'rw'}])
|
||||||
my_resource = docker_container.DockerContainer(
|
my_resource = docker_container.DockerContainer(
|
||||||
'Blog', definition, self.stack)
|
'Blog', definition.freeze(properties=props), self.stack)
|
||||||
get_client_mock = self.patchobject(my_resource, 'get_client')
|
get_client_mock = self.patchobject(my_resource, 'get_client')
|
||||||
get_client_mock.return_value = docker.Client()
|
get_client_mock.return_value = docker.Client()
|
||||||
self.assertIsNone(my_resource.validate())
|
self.assertIsNone(my_resource.validate())
|
||||||
@ -393,13 +400,14 @@ class DockerContainerTest(common.HeatTestCase):
|
|||||||
t = template_format.parse(template)
|
t = template_format.parse(template)
|
||||||
self.stack = utils.parse_stack(t)
|
self.stack = utils.parse_stack(t)
|
||||||
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
||||||
definition['Properties']['devices'] = (
|
props = t['Resources']['Blog']['Properties'].copy()
|
||||||
|
props['devices'] = (
|
||||||
[{'path_on_host': '/dev/sdb',
|
[{'path_on_host': '/dev/sdb',
|
||||||
'path_in_container': '/dev/xvdc',
|
'path_in_container': '/dev/xvdc',
|
||||||
'permissions': 'r'}])
|
'permissions': 'r'}])
|
||||||
definition['Properties']['privileged'] = True
|
props['privileged'] = True
|
||||||
my_resource = docker_container.DockerContainer(
|
my_resource = docker_container.DockerContainer(
|
||||||
'Blog', definition, self.stack)
|
'Blog', definition.freeze(properties=props), self.stack)
|
||||||
get_client_mock = self.patchobject(my_resource, 'get_client')
|
get_client_mock = self.patchobject(my_resource, 'get_client')
|
||||||
get_client_mock.return_value = docker.Client()
|
get_client_mock.return_value = docker.Client()
|
||||||
self.assertIsNone(my_resource.validate())
|
self.assertIsNone(my_resource.validate())
|
||||||
@ -420,11 +428,11 @@ class DockerContainerTest(common.HeatTestCase):
|
|||||||
t = template_format.parse(template)
|
t = template_format.parse(template)
|
||||||
self.stack = utils.parse_stack(t)
|
self.stack = utils.parse_stack(t)
|
||||||
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
||||||
definition['Properties']['devices'] = (
|
props = t['Resources']['Blog']['Properties'].copy()
|
||||||
[{'path_on_host': '/dev/sda',
|
props['devices'] = [{'path_on_host': '/dev/sda',
|
||||||
'permissions': 'rwm'}])
|
'permissions': 'rwm'}]
|
||||||
my_resource = docker_container.DockerContainer(
|
my_resource = docker_container.DockerContainer(
|
||||||
'Blog', definition, self.stack)
|
'Blog', definition.freeze(properties=props), self.stack)
|
||||||
get_client_mock = self.patchobject(my_resource, 'get_client')
|
get_client_mock = self.patchobject(my_resource, 'get_client')
|
||||||
get_client_mock.return_value = docker.Client()
|
get_client_mock.return_value = docker.Client()
|
||||||
self.assertIsNone(my_resource.validate())
|
self.assertIsNone(my_resource.validate())
|
||||||
@ -440,9 +448,10 @@ class DockerContainerTest(common.HeatTestCase):
|
|||||||
t = template_format.parse(template)
|
t = template_format.parse(template)
|
||||||
self.stack = utils.parse_stack(t)
|
self.stack = utils.parse_stack(t)
|
||||||
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
definition = self.stack.t.resource_definitions(self.stack)['Blog']
|
||||||
definition['Properties']['cpu_set'] = '0-8,16-24,28'
|
props = t['Resources']['Blog']['Properties'].copy()
|
||||||
|
props['cpu_set'] = '0-8,16-24,28'
|
||||||
my_resource = docker_container.DockerContainer(
|
my_resource = docker_container.DockerContainer(
|
||||||
'Blog', definition, self.stack)
|
'Blog', definition.freeze(properties=props), self.stack)
|
||||||
get_client_mock = self.patchobject(my_resource, 'get_client')
|
get_client_mock = self.patchobject(my_resource, 'get_client')
|
||||||
get_client_mock.return_value = docker.Client()
|
get_client_mock.return_value = docker.Client()
|
||||||
self.assertIsNone(my_resource.validate())
|
self.assertIsNone(my_resource.validate())
|
||||||
|
@ -316,26 +316,28 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(LoadBalancerTest, self).setUp()
|
super(LoadBalancerTest, self).setUp()
|
||||||
|
|
||||||
|
self.lb_props = {
|
||||||
|
"name": "test-clb",
|
||||||
|
"nodes": [{"addresses": ["166.78.103.141"],
|
||||||
|
"port": 80,
|
||||||
|
"condition": "ENABLED"}],
|
||||||
|
"protocol": "HTTP",
|
||||||
|
"port": 80,
|
||||||
|
"virtualIps": [
|
||||||
|
{"type": "PUBLIC", "ipVersion": "IPV6"}],
|
||||||
|
"algorithm": 'LEAST_CONNECTIONS',
|
||||||
|
"connectionThrottle": {'maxConnectionRate': 1000},
|
||||||
|
'timeout': 110,
|
||||||
|
'contentCaching': 'DISABLED'
|
||||||
|
}
|
||||||
|
|
||||||
self.lb_template = {
|
self.lb_template = {
|
||||||
"AWSTemplateFormatVersion": "2010-09-09",
|
"AWSTemplateFormatVersion": "2010-09-09",
|
||||||
"Description": "fawef",
|
"Description": "fawef",
|
||||||
"Resources": {
|
"Resources": {
|
||||||
self._get_lb_resource_name(): {
|
self._get_lb_resource_name(): {
|
||||||
"Type": "Rackspace::Cloud::LoadBalancer",
|
"Type": "Rackspace::Cloud::LoadBalancer",
|
||||||
"Properties": {
|
"Properties": self.lb_props,
|
||||||
"name": "test-clb",
|
|
||||||
"nodes": [{"addresses": ["166.78.103.141"],
|
|
||||||
"port": 80,
|
|
||||||
"condition": "ENABLED"}],
|
|
||||||
"protocol": "HTTP",
|
|
||||||
"port": 80,
|
|
||||||
"virtualIps": [
|
|
||||||
{"type": "PUBLIC", "ipVersion": "IPV6"}],
|
|
||||||
"algorithm": 'LEAST_CONNECTIONS',
|
|
||||||
"connectionThrottle": {'maxConnectionRate': 1000},
|
|
||||||
'timeout': 110,
|
|
||||||
'contentCaching': 'DISABLED'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -812,9 +814,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
expected_ip = '172.168.1.4'
|
expected_ip = '172.168.1.4'
|
||||||
update_template['Properties']['nodes'] = [
|
props['nodes'] = [
|
||||||
{"addresses": ["166.78.103.141"],
|
{"addresses": ["166.78.103.141"],
|
||||||
"port": 80,
|
"port": 80,
|
||||||
"condition": "ENABLED",
|
"condition": "ENABLED",
|
||||||
@ -825,6 +827,7 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
"condition": "ENABLED",
|
"condition": "ENABLED",
|
||||||
"type": "PRIMARY",
|
"type": "PRIMARY",
|
||||||
"weight": 1}]
|
"weight": 1}]
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.UnsetStubs()
|
self.m.UnsetStubs()
|
||||||
self.m.StubOutWithMock(rsrc.clb, 'get')
|
self.m.StubOutWithMock(rsrc.clb, 'get')
|
||||||
@ -894,9 +897,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
expected_ip = '4.4.4.4'
|
expected_ip = '4.4.4.4'
|
||||||
update_template['Properties']['nodes'] = [
|
props['nodes'] = [
|
||||||
{"addresses": ["1.1.1.1"], "port": 80, "condition": "ENABLED",
|
{"addresses": ["1.1.1.1"], "port": 80, "condition": "ENABLED",
|
||||||
"type": "PRIMARY", "weight": 1},
|
"type": "PRIMARY", "weight": 1},
|
||||||
{"addresses": ["2.2.2.2"], "port": 80, "condition": "DISABLED",
|
{"addresses": ["2.2.2.2"], "port": 80, "condition": "DISABLED",
|
||||||
@ -904,6 +907,7 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
{"addresses": [expected_ip], "port": 80, "condition": "ENABLED",
|
{"addresses": [expected_ip], "port": 80, "condition": "ENABLED",
|
||||||
"type": "PRIMARY", "weight": 1}
|
"type": "PRIMARY", "weight": 1}
|
||||||
]
|
]
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.UnsetStubs()
|
self.m.UnsetStubs()
|
||||||
self.m.StubOutWithMock(rsrc.clb, 'get')
|
self.m.StubOutWithMock(rsrc.clb, 'get')
|
||||||
@ -978,8 +982,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['name'] = "updated_name"
|
props['name'] = "updated_name"
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.UnsetStubs()
|
self.m.UnsetStubs()
|
||||||
self.m.StubOutWithMock(rsrc.clb, 'get')
|
self.m.StubOutWithMock(rsrc.clb, 'get')
|
||||||
@ -1005,8 +1010,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['name'] = "updated_name"
|
props['name'] = "updated_name"
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.UnsetStubs()
|
self.m.UnsetStubs()
|
||||||
self.m.StubOutWithMock(rsrc.clb, 'get')
|
self.m.StubOutWithMock(rsrc.clb, 'get')
|
||||||
@ -1060,8 +1066,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['name'] = "updated_name"
|
props['name'] = "updated_name"
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.UnsetStubs()
|
self.m.UnsetStubs()
|
||||||
self.m.StubOutWithMock(rsrc.clb, 'get')
|
self.m.StubOutWithMock(rsrc.clb, 'get')
|
||||||
@ -1085,9 +1092,10 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['name'] = "updated_name"
|
props['name'] = "updated_name"
|
||||||
update_template['Properties']['algorithm'] = "RANDOM"
|
props['algorithm'] = "RANDOM"
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.UnsetStubs()
|
self.m.UnsetStubs()
|
||||||
self.m.StubOutWithMock(rsrc.clb, 'get')
|
self.m.StubOutWithMock(rsrc.clb, 'get')
|
||||||
@ -1115,8 +1123,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['algorithm'] = "RANDOM"
|
props['algorithm'] = "RANDOM"
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.UnsetStubs()
|
self.m.UnsetStubs()
|
||||||
self.m.StubOutWithMock(rsrc.clb, 'get')
|
self.m.StubOutWithMock(rsrc.clb, 'get')
|
||||||
@ -1143,8 +1152,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['protocol'] = "IMAPS"
|
props['protocol'] = "IMAPS"
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.UnsetStubs()
|
self.m.UnsetStubs()
|
||||||
self.m.StubOutWithMock(rsrc.clb, 'get')
|
self.m.StubOutWithMock(rsrc.clb, 'get')
|
||||||
@ -1174,8 +1184,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(template['Resources'][rsrc.name]['Properties'])
|
||||||
update_template['Properties']['httpsRedirect'] = True
|
props['httpsRedirect'] = True
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.UnsetStubs()
|
self.m.UnsetStubs()
|
||||||
self.m.StubOutWithMock(rsrc.clb, 'get')
|
self.m.StubOutWithMock(rsrc.clb, 'get')
|
||||||
@ -1261,8 +1272,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['halfClosed'] = True
|
props['halfClosed'] = True
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.UnsetStubs()
|
self.m.UnsetStubs()
|
||||||
self.m.StubOutWithMock(rsrc.clb, 'get')
|
self.m.StubOutWithMock(rsrc.clb, 'get')
|
||||||
@ -1286,8 +1298,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['port'] = 1234
|
props['port'] = 1234
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.UnsetStubs()
|
self.m.UnsetStubs()
|
||||||
self.m.StubOutWithMock(rsrc.clb, 'get')
|
self.m.StubOutWithMock(rsrc.clb, 'get')
|
||||||
@ -1311,8 +1324,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['timeout'] = 120
|
props['timeout'] = 120
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.UnsetStubs()
|
self.m.UnsetStubs()
|
||||||
self.m.StubOutWithMock(rsrc.clb, 'get')
|
self.m.StubOutWithMock(rsrc.clb, 'get')
|
||||||
@ -1336,12 +1350,13 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['healthMonitor'] = {
|
props['healthMonitor'] = {
|
||||||
'type': "HTTP", 'delay': 10, 'timeout': 10,
|
'type': "HTTP", 'delay': 10, 'timeout': 10,
|
||||||
'attemptsBeforeDeactivation': 4, 'path': "/",
|
'attemptsBeforeDeactivation': 4, 'path': "/",
|
||||||
'statusRegex': "^[234][0-9][0-9]$", 'bodyRegex': ".* testing .*",
|
'statusRegex': "^[234][0-9][0-9]$", 'bodyRegex': ".* testing .*",
|
||||||
'hostHeader': "example.com"}
|
'hostHeader': "example.com"}
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.StubOutWithMock(fake_lb, 'get_health_monitor')
|
self.m.StubOutWithMock(fake_lb, 'get_health_monitor')
|
||||||
fake_lb.get_health_monitor().AndReturn({})
|
fake_lb.get_health_monitor().AndReturn({})
|
||||||
@ -1379,8 +1394,7 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
update_template = rsrc.t.freeze(properties=self.lb_props)
|
||||||
del update_template['Properties']['healthMonitor']
|
|
||||||
|
|
||||||
self.m.StubOutWithMock(fake_lb, 'get_health_monitor')
|
self.m.StubOutWithMock(fake_lb, 'get_health_monitor')
|
||||||
fake_lb.get_health_monitor().AndReturn(
|
fake_lb.get_health_monitor().AndReturn(
|
||||||
@ -1406,8 +1420,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['sessionPersistence'] = 'SOURCE_IP'
|
props['sessionPersistence'] = 'SOURCE_IP'
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
|
|
||||||
@ -1430,8 +1445,7 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
update_template = rsrc.t.freeze(properties=self.lb_props)
|
||||||
del update_template['Properties']['sessionPersistence']
|
|
||||||
|
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
|
|
||||||
@ -1447,10 +1461,15 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['sslTermination'] = {
|
props['sslTermination'] = {
|
||||||
'securePort': 443, 'privatekey': private_key, 'certificate': cert,
|
'securePort': 443,
|
||||||
'secureTrafficOnly': False, 'intermediateCertificate': ''}
|
'privatekey': private_key,
|
||||||
|
'certificate': cert,
|
||||||
|
'secureTrafficOnly': False,
|
||||||
|
'intermediateCertificate': ''
|
||||||
|
}
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.StubOutWithMock(fake_lb, 'get_ssl_termination')
|
self.m.StubOutWithMock(fake_lb, 'get_ssl_termination')
|
||||||
fake_lb.get_ssl_termination().AndReturn({})
|
fake_lb.get_ssl_termination().AndReturn({})
|
||||||
@ -1497,8 +1516,7 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
self.m.UnsetStubs()
|
self.m.UnsetStubs()
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
update_template = rsrc.t.freeze(properties=self.lb_props)
|
||||||
del update_template['Properties']['sslTermination']
|
|
||||||
|
|
||||||
self.m.StubOutWithMock(rsrc.clb, 'get')
|
self.m.StubOutWithMock(rsrc.clb, 'get')
|
||||||
rsrc.clb.get(mox.IgnoreArg()).MultipleTimes().AndReturn(
|
rsrc.clb.get(mox.IgnoreArg()).MultipleTimes().AndReturn(
|
||||||
@ -1527,8 +1545,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['metadata'] = {'a': 1, 'b': 2}
|
props['metadata'] = {'a': 1, 'b': 2}
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.StubOutWithMock(fake_lb, 'get_metadata')
|
self.m.StubOutWithMock(fake_lb, 'get_metadata')
|
||||||
fake_lb.get_metadata().AndReturn({})
|
fake_lb.get_metadata().AndReturn({})
|
||||||
@ -1557,8 +1576,7 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
update_template = rsrc.t.freeze(properties=self.lb_props)
|
||||||
del update_template['Properties']['metadata']
|
|
||||||
|
|
||||||
self.m.StubOutWithMock(fake_lb, 'get_metadata')
|
self.m.StubOutWithMock(fake_lb, 'get_metadata')
|
||||||
fake_lb.get_metadata().AndReturn({'a': 1, 'b': 2})
|
fake_lb.get_metadata().AndReturn({'a': 1, 'b': 2})
|
||||||
@ -1584,8 +1602,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
'<html><head><title>Service Unavailable</title></head><body><h2>'
|
'<html><head><title>Service Unavailable</title></head><body><h2>'
|
||||||
'Service Unavailable</h2>The service is unavailable</body></html>')
|
'Service Unavailable</h2>The service is unavailable</body></html>')
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['errorPage'] = error_page
|
props['errorPage'] = error_page
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.StubOutWithMock(fake_lb, 'get_error_page')
|
self.m.StubOutWithMock(fake_lb, 'get_error_page')
|
||||||
fake_lb.get_error_page().AndReturn(
|
fake_lb.get_error_page().AndReturn(
|
||||||
@ -1627,8 +1646,7 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
self.m.UnsetStubs()
|
self.m.UnsetStubs()
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
update_template = rsrc.t.freeze(properties=self.lb_props)
|
||||||
del update_template['Properties']['errorPage']
|
|
||||||
|
|
||||||
self.m.StubOutWithMock(rsrc.clb, 'get')
|
self.m.StubOutWithMock(rsrc.clb, 'get')
|
||||||
rsrc.clb.get(mox.IgnoreArg()).MultipleTimes().AndReturn(
|
rsrc.clb.get(mox.IgnoreArg()).MultipleTimes().AndReturn(
|
||||||
@ -1655,8 +1673,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['connectionLogging'] = True
|
props['connectionLogging'] = True
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||||
@ -1688,8 +1707,7 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
fake_lb2.connection_logging = False
|
fake_lb2.connection_logging = False
|
||||||
rsrc.clb.get(mox.IgnoreArg()).AndReturn(fake_lb2)
|
rsrc.clb.get(mox.IgnoreArg()).AndReturn(fake_lb2)
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
update_template = rsrc.t.freeze(properties=self.lb_props)
|
||||||
del update_template['Properties']['connectionLogging']
|
|
||||||
|
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
|
|
||||||
@ -1712,8 +1730,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['connectionLogging'] = False
|
props['connectionLogging'] = False
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
|
|
||||||
@ -1729,9 +1748,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['connectionThrottle'] = {
|
props['connectionThrottle'] = {'maxConnections': 1000}
|
||||||
'maxConnections': 1000}
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.StubOutWithMock(fake_lb, 'add_connection_throttle')
|
self.m.StubOutWithMock(fake_lb, 'add_connection_throttle')
|
||||||
self.m.StubOutWithMock(fake_lb, 'get_connection_throttle')
|
self.m.StubOutWithMock(fake_lb, 'get_connection_throttle')
|
||||||
@ -1768,8 +1787,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
del update_template['Properties']['connectionThrottle']
|
del props['connectionThrottle']
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.StubOutWithMock(fake_lb, 'get_connection_throttle')
|
self.m.StubOutWithMock(fake_lb, 'get_connection_throttle')
|
||||||
fake_lb.get_connection_throttle().AndReturn({
|
fake_lb.get_connection_throttle().AndReturn({
|
||||||
@ -1793,8 +1813,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['contentCaching'] = 'ENABLED'
|
props['contentCaching'] = 'ENABLED'
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.UnsetStubs()
|
self.m.UnsetStubs()
|
||||||
self.m.StubOutWithMock(rsrc.clb, 'get')
|
self.m.StubOutWithMock(rsrc.clb, 'get')
|
||||||
@ -1823,8 +1844,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
del update_template['Properties']['contentCaching']
|
del props['contentCaching']
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.UnsetStubs()
|
self.m.UnsetStubs()
|
||||||
self.m.StubOutWithMock(rsrc.clb, 'get')
|
self.m.StubOutWithMock(rsrc.clb, 'get')
|
||||||
@ -1854,8 +1876,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['contentCaching'] = 'DISABLED'
|
props['contentCaching'] = 'DISABLED'
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.UnsetStubs()
|
self.m.UnsetStubs()
|
||||||
self.m.StubOutWithMock(rsrc.clb, 'get')
|
self.m.StubOutWithMock(rsrc.clb, 'get')
|
||||||
@ -2051,9 +2074,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
expected_ip = '172.168.1.4'
|
expected_ip = '172.168.1.4'
|
||||||
update_template['Properties']['nodes'] = [
|
props['nodes'] = [
|
||||||
{"addresses": ["166.78.103.141"],
|
{"addresses": ["166.78.103.141"],
|
||||||
"port": 80,
|
"port": 80,
|
||||||
"condition": "DRAINING",
|
"condition": "DRAINING",
|
||||||
@ -2064,6 +2087,7 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
"condition": "DRAINING",
|
"condition": "DRAINING",
|
||||||
"type": "PRIMARY",
|
"type": "PRIMARY",
|
||||||
"weight": 1}]
|
"weight": 1}]
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.UnsetStubs()
|
self.m.UnsetStubs()
|
||||||
self.m.StubOutWithMock(rsrc.clb, 'get')
|
self.m.StubOutWithMock(rsrc.clb, 'get')
|
||||||
@ -2100,8 +2124,8 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['nodes'] = [
|
props['nodes'] = [
|
||||||
{"addresses": ["166.78.103.141"],
|
{"addresses": ["166.78.103.141"],
|
||||||
"port": 80,
|
"port": 80,
|
||||||
"condition": "ENABLED",
|
"condition": "ENABLED",
|
||||||
@ -2112,6 +2136,7 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
"condition": "ENABLED",
|
"condition": "ENABLED",
|
||||||
"type": "PRIMARY",
|
"type": "PRIMARY",
|
||||||
"weight": 1}]
|
"weight": 1}]
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
self.m.UnsetStubs()
|
self.m.UnsetStubs()
|
||||||
self.m.StubOutWithMock(rsrc.clb, 'get')
|
self.m.StubOutWithMock(rsrc.clb, 'get')
|
||||||
@ -2160,10 +2185,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = copy.deepcopy(self.lb_props)
|
||||||
update_template['Properties']['nodes'] = [
|
props['nodes'] = [{"addresses": ["166.78.103.141"], "port": 80}]
|
||||||
{"addresses": ["166.78.103.141"],
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
"port": 80}]
|
|
||||||
|
|
||||||
self.m.UnsetStubs()
|
self.m.UnsetStubs()
|
||||||
self.m.StubOutWithMock(rsrc.clb, 'get')
|
self.m.StubOutWithMock(rsrc.clb, 'get')
|
||||||
|
@ -561,14 +561,9 @@ class RollingUpdatePolicyDiffTest(common.HeatTestCase):
|
|||||||
else None)
|
else None)
|
||||||
self.assertTrue(tmpl_diff.properties_changed())
|
self.assertTrue(tmpl_diff.properties_changed())
|
||||||
|
|
||||||
# test application of the new update policy in handle_update
|
|
||||||
update_snippet = rsrc_defn.ResourceDefinition(
|
|
||||||
current_grp.name,
|
|
||||||
current_grp.type(),
|
|
||||||
properties=updated_grp.t['Properties'])
|
|
||||||
current_grp._try_rolling_update = mock.MagicMock()
|
current_grp._try_rolling_update = mock.MagicMock()
|
||||||
current_grp.resize = mock.MagicMock()
|
current_grp.resize = mock.MagicMock()
|
||||||
current_grp.handle_update(update_snippet, tmpl_diff, None)
|
current_grp.handle_update(updated_grp_json, tmpl_diff, None)
|
||||||
if updated_policy is None:
|
if updated_policy is None:
|
||||||
self.assertIsNone(
|
self.assertIsNone(
|
||||||
current_grp.properties.data.get('rolling_updates'))
|
current_grp.properties.data.get('rolling_updates'))
|
||||||
|
@ -705,23 +705,14 @@ class RollingUpdatePolicyDiffTest(common.HeatTestCase):
|
|||||||
# identify the template difference
|
# identify the template difference
|
||||||
tmpl_diff = updated_grp.update_template_diff(
|
tmpl_diff = updated_grp.update_template_diff(
|
||||||
updated_grp_json, current_grp_json)
|
updated_grp_json, current_grp_json)
|
||||||
updated_policy = (updated_grp.t['UpdatePolicy']
|
|
||||||
if 'UpdatePolicy' in updated_grp.t else None)
|
|
||||||
self.assertTrue(tmpl_diff.update_policy_changed())
|
self.assertTrue(tmpl_diff.update_policy_changed())
|
||||||
|
|
||||||
# test application of the new update policy in handle_update
|
# test application of the new update policy in handle_update
|
||||||
update_snippet = rsrc_defn.ResourceDefinition(
|
|
||||||
current_grp.name,
|
|
||||||
current_grp.type(),
|
|
||||||
properties=updated_grp.t['Properties'],
|
|
||||||
update_policy=updated_policy)
|
|
||||||
current_grp._try_rolling_update = mock.MagicMock()
|
current_grp._try_rolling_update = mock.MagicMock()
|
||||||
current_grp.resize = mock.MagicMock()
|
current_grp.resize = mock.MagicMock()
|
||||||
current_grp.handle_update(update_snippet, tmpl_diff, None)
|
current_grp.handle_update(updated_grp_json, tmpl_diff, None)
|
||||||
if updated_policy is None:
|
self.assertEqual(updated_grp_json._update_policy or {},
|
||||||
self.assertEqual({}, current_grp.update_policy.data)
|
current_grp.update_policy.data)
|
||||||
else:
|
|
||||||
self.assertEqual(updated_policy, current_grp.update_policy.data)
|
|
||||||
|
|
||||||
def test_update_policy_added(self):
|
def test_update_policy_added(self):
|
||||||
self.validate_update_policy_diff(inline_templates.as_template,
|
self.validate_update_policy_diff(inline_templates.as_template,
|
||||||
|
@ -124,6 +124,7 @@ class InstancesTest(common.HeatTestCase):
|
|||||||
stack_name = '%s_s' % name
|
stack_name = '%s_s' % name
|
||||||
tmpl, self.stack = self._get_test_template(stack_name, image_id,
|
tmpl, self.stack = self._get_test_template(stack_name, image_id,
|
||||||
volumes=volumes)
|
volumes=volumes)
|
||||||
|
self.instance_props = tmpl.t['Resources']['WebServer']['Properties']
|
||||||
resource_defns = tmpl.resource_definitions(self.stack)
|
resource_defns = tmpl.resource_definitions(self.stack)
|
||||||
instance = instances.Instance(name, resource_defns['WebServer'],
|
instance = instances.Instance(name, resource_defns['WebServer'],
|
||||||
self.stack)
|
self.stack)
|
||||||
@ -723,8 +724,9 @@ class InstancesTest(common.HeatTestCase):
|
|||||||
instance = self._create_test_instance(return_server,
|
instance = self._create_test_instance(return_server,
|
||||||
'ud_type')
|
'ud_type')
|
||||||
|
|
||||||
update_template = copy.deepcopy(instance.t)
|
update_props = self.instance_props.copy()
|
||||||
update_template['Properties']['InstanceType'] = 'm1.small'
|
update_props['InstanceType'] = 'm1.small'
|
||||||
|
update_template = instance.t.freeze(properties=update_props)
|
||||||
|
|
||||||
def side_effect(*args):
|
def side_effect(*args):
|
||||||
return 2 if args[0] == 'm1.small' else 1
|
return 2 if args[0] == 'm1.small' else 1
|
||||||
@ -786,8 +788,9 @@ class InstancesTest(common.HeatTestCase):
|
|||||||
self.patchobject(glance.GlanceClientPlugin, 'find_image_by_name_or_id',
|
self.patchobject(glance.GlanceClientPlugin, 'find_image_by_name_or_id',
|
||||||
return_value=1)
|
return_value=1)
|
||||||
|
|
||||||
update_template = copy.deepcopy(instance.t)
|
update_props = self.instance_props.copy()
|
||||||
update_template['Properties']['InstanceType'] = 'm1.small'
|
update_props['InstanceType'] = 'm1.small'
|
||||||
|
update_template = instance.t.freeze(properties=update_props)
|
||||||
|
|
||||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||||
|
|
||||||
@ -850,9 +853,13 @@ class InstancesTest(common.HeatTestCase):
|
|||||||
{'NetworkInterfaceId': '34b752ec-14de-416a-8722-9531015e04a5',
|
{'NetworkInterfaceId': '34b752ec-14de-416a-8722-9531015e04a5',
|
||||||
'DeviceIndex': '3'}]
|
'DeviceIndex': '3'}]
|
||||||
|
|
||||||
instance.t['Properties']['NetworkInterfaces'] = old_interfaces
|
before_props = self.instance_props.copy()
|
||||||
update_template = copy.deepcopy(instance.t)
|
before_props['NetworkInterfaces'] = old_interfaces
|
||||||
update_template['Properties']['NetworkInterfaces'] = new_interfaces
|
update_props = self.instance_props.copy()
|
||||||
|
update_props['NetworkInterfaces'] = new_interfaces
|
||||||
|
update_template = instance.t.freeze(properties=update_props)
|
||||||
|
instance.t = instance.t.freeze(properties=before_props)
|
||||||
|
instance.reparse()
|
||||||
|
|
||||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||||
self.fc.servers.get('1234').MultipleTimes().AndReturn(return_server)
|
self.fc.servers.get('1234').MultipleTimes().AndReturn(return_server)
|
||||||
@ -889,9 +896,13 @@ class InstancesTest(common.HeatTestCase):
|
|||||||
{'NetworkInterfaceId': 'ea29f957-cd35-4364-98fb-57ce9732c10d',
|
{'NetworkInterfaceId': 'ea29f957-cd35-4364-98fb-57ce9732c10d',
|
||||||
'DeviceIndex': '2'}]
|
'DeviceIndex': '2'}]
|
||||||
|
|
||||||
instance.t['Properties']['NetworkInterfaces'] = old_interfaces
|
before_props = self.instance_props.copy()
|
||||||
update_template = copy.deepcopy(instance.t)
|
before_props['NetworkInterfaces'] = old_interfaces
|
||||||
update_template['Properties']['NetworkInterfaces'] = new_interfaces
|
update_props = self.instance_props.copy()
|
||||||
|
update_props['NetworkInterfaces'] = new_interfaces
|
||||||
|
update_template = instance.t.freeze(properties=update_props)
|
||||||
|
instance.t = instance.t.freeze(properties=before_props)
|
||||||
|
instance.reparse()
|
||||||
|
|
||||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||||
self.fc.servers.get('1234').MultipleTimes().AndReturn(return_server)
|
self.fc.servers.get('1234').MultipleTimes().AndReturn(return_server)
|
||||||
@ -925,9 +936,13 @@ class InstancesTest(common.HeatTestCase):
|
|||||||
{'NetworkInterfaceId': 'd1e9c73c-04fe-4e9e-983c-d5ef94cd1a46',
|
{'NetworkInterfaceId': 'd1e9c73c-04fe-4e9e-983c-d5ef94cd1a46',
|
||||||
'DeviceIndex': '1'}]
|
'DeviceIndex': '1'}]
|
||||||
|
|
||||||
instance.t['Properties']['NetworkInterfaces'] = old_interfaces
|
before_props = self.instance_props.copy()
|
||||||
update_template = copy.deepcopy(instance.t)
|
before_props['NetworkInterfaces'] = old_interfaces
|
||||||
update_template['Properties']['NetworkInterfaces'] = new_interfaces
|
update_props = self.instance_props.copy()
|
||||||
|
update_props['NetworkInterfaces'] = new_interfaces
|
||||||
|
update_template = instance.t.freeze(properties=update_props)
|
||||||
|
instance.t = instance.t.freeze(properties=before_props)
|
||||||
|
instance.reparse()
|
||||||
|
|
||||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||||
self.fc.servers.get('1234').MultipleTimes().AndReturn(return_server)
|
self.fc.servers.get('1234').MultipleTimes().AndReturn(return_server)
|
||||||
@ -961,9 +976,13 @@ class InstancesTest(common.HeatTestCase):
|
|||||||
{'NetworkInterfaceId': 'd1e9c73c-04fe-4e9e-983c-d5ef94cd1a46',
|
{'NetworkInterfaceId': 'd1e9c73c-04fe-4e9e-983c-d5ef94cd1a46',
|
||||||
'DeviceIndex': '1'}]
|
'DeviceIndex': '1'}]
|
||||||
|
|
||||||
instance.t['Properties']['NetworkInterfaces'] = old_interfaces
|
before_props = self.instance_props.copy()
|
||||||
update_template = copy.deepcopy(instance.t)
|
before_props['NetworkInterfaces'] = old_interfaces
|
||||||
update_template['Properties']['NetworkInterfaces'] = new_interfaces
|
update_props = self.instance_props.copy()
|
||||||
|
update_props['NetworkInterfaces'] = new_interfaces
|
||||||
|
update_template = instance.t.freeze(properties=update_props)
|
||||||
|
instance.t = instance.t.freeze(properties=before_props)
|
||||||
|
instance.reparse()
|
||||||
|
|
||||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||||
self.fc.servers.get('1234').MultipleTimes().AndReturn(return_server)
|
self.fc.servers.get('1234').MultipleTimes().AndReturn(return_server)
|
||||||
@ -1001,8 +1020,9 @@ class InstancesTest(common.HeatTestCase):
|
|||||||
'c4485ba1-283a-4f5f-8868-0cd46cdda52f',
|
'c4485ba1-283a-4f5f-8868-0cd46cdda52f',
|
||||||
'10.0.0.4')
|
'10.0.0.4')
|
||||||
|
|
||||||
update_template = copy.deepcopy(instance.t)
|
update_props = self.instance_props.copy()
|
||||||
update_template['Properties']['NetworkInterfaces'] = new_interfaces
|
update_props['NetworkInterfaces'] = new_interfaces
|
||||||
|
update_template = instance.t.freeze(properties=update_props)
|
||||||
|
|
||||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||||
self.fc.servers.get('1234').MultipleTimes().AndReturn(return_server)
|
self.fc.servers.get('1234').MultipleTimes().AndReturn(return_server)
|
||||||
@ -1037,8 +1057,9 @@ class InstancesTest(common.HeatTestCase):
|
|||||||
'c4485ba1-283a-4f5f-8868-0cd46cdda52f',
|
'c4485ba1-283a-4f5f-8868-0cd46cdda52f',
|
||||||
'10.0.0.4')
|
'10.0.0.4')
|
||||||
|
|
||||||
update_template = copy.deepcopy(instance.t)
|
update_props = self.instance_props.copy()
|
||||||
update_template['Properties']['NetworkInterfaces'] = []
|
update_props['NetworkInterfaces'] = []
|
||||||
|
update_template = instance.t.freeze(properties=update_props)
|
||||||
|
|
||||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||||
self.fc.servers.get('1234').MultipleTimes().AndReturn(return_server)
|
self.fc.servers.get('1234').MultipleTimes().AndReturn(return_server)
|
||||||
@ -1069,12 +1090,18 @@ class InstancesTest(common.HeatTestCase):
|
|||||||
'10.0.0.4')
|
'10.0.0.4')
|
||||||
subnet_id = '8c1aaddf-e49e-4f28-93ea-ca9f0b3c6240'
|
subnet_id = '8c1aaddf-e49e-4f28-93ea-ca9f0b3c6240'
|
||||||
nics = [{'port-id': 'ea29f957-cd35-4364-98fb-57ce9732c10d'}]
|
nics = [{'port-id': 'ea29f957-cd35-4364-98fb-57ce9732c10d'}]
|
||||||
|
|
||||||
|
before_props = self.instance_props.copy()
|
||||||
if old_interfaces is not None:
|
if old_interfaces is not None:
|
||||||
instance.t['Properties']['NetworkInterfaces'] = old_interfaces
|
before_props['NetworkInterfaces'] = old_interfaces
|
||||||
update_template = copy.deepcopy(instance.t)
|
update_props = self.instance_props.copy()
|
||||||
if new_interfaces is not None:
|
if new_interfaces is not None:
|
||||||
update_template['Properties']['NetworkInterfaces'] = new_interfaces
|
update_props['NetworkInterfaces'] = new_interfaces
|
||||||
update_template['Properties']['SubnetId'] = subnet_id
|
update_props['SubnetId'] = subnet_id
|
||||||
|
|
||||||
|
update_template = instance.t.freeze(properties=update_props)
|
||||||
|
instance.t = instance.t.freeze(properties=before_props)
|
||||||
|
instance.reparse()
|
||||||
|
|
||||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||||
|
|
||||||
@ -1133,8 +1160,9 @@ class InstancesTest(common.HeatTestCase):
|
|||||||
self.stub_ImageConstraint_validate()
|
self.stub_ImageConstraint_validate()
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
|
|
||||||
update_template = copy.deepcopy(instance.t)
|
update_props = self.instance_props.copy()
|
||||||
update_template['Properties']['ImageId'] = 'mustreplace'
|
update_props['ImageId'] = 'mustreplace'
|
||||||
|
update_template = instance.t.freeze(properties=update_props)
|
||||||
updater = scheduler.TaskRunner(instance.update, update_template)
|
updater = scheduler.TaskRunner(instance.update, update_template)
|
||||||
self.assertRaises(exception.UpdateReplace, updater)
|
self.assertRaises(exception.UpdateReplace, updater)
|
||||||
|
|
||||||
|
@ -228,12 +228,12 @@ class instancesTest(common.HeatTestCase):
|
|||||||
# need to resolve the template functions
|
# need to resolve the template functions
|
||||||
server_userdata = instance.client_plugin().build_userdata(
|
server_userdata = instance.client_plugin().build_userdata(
|
||||||
metadata,
|
metadata,
|
||||||
instance.t['Properties']['UserData'],
|
instance.properties['UserData'],
|
||||||
'ec2-user')
|
'ec2-user')
|
||||||
self.m.StubOutWithMock(nova.NovaClientPlugin, 'build_userdata')
|
self.m.StubOutWithMock(nova.NovaClientPlugin, 'build_userdata')
|
||||||
nova.NovaClientPlugin.build_userdata(
|
nova.NovaClientPlugin.build_userdata(
|
||||||
metadata,
|
metadata,
|
||||||
instance.t['Properties']['UserData'],
|
instance.properties['UserData'],
|
||||||
'ec2-user').AndReturn(server_userdata)
|
'ec2-user').AndReturn(server_userdata)
|
||||||
|
|
||||||
self.m.StubOutWithMock(self.fc.servers, 'create')
|
self.m.StubOutWithMock(self.fc.servers, 'create')
|
||||||
@ -288,12 +288,12 @@ class instancesTest(common.HeatTestCase):
|
|||||||
# need to resolve the template functions
|
# need to resolve the template functions
|
||||||
server_userdata = instance.client_plugin().build_userdata(
|
server_userdata = instance.client_plugin().build_userdata(
|
||||||
metadata,
|
metadata,
|
||||||
instance.t['Properties']['UserData'],
|
instance.properties['UserData'],
|
||||||
'ec2-user')
|
'ec2-user')
|
||||||
self.m.StubOutWithMock(nova.NovaClientPlugin, 'build_userdata')
|
self.m.StubOutWithMock(nova.NovaClientPlugin, 'build_userdata')
|
||||||
nova.NovaClientPlugin.build_userdata(
|
nova.NovaClientPlugin.build_userdata(
|
||||||
metadata,
|
metadata,
|
||||||
instance.t['Properties']['UserData'],
|
instance.properties['UserData'],
|
||||||
'ec2-user').AndReturn(server_userdata)
|
'ec2-user').AndReturn(server_userdata)
|
||||||
|
|
||||||
self.m.StubOutWithMock(self.fc.servers, 'create')
|
self.m.StubOutWithMock(self.fc.servers, 'create')
|
||||||
|
@ -128,27 +128,25 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
md.metadata_set.assert_called_once_with(expected_md)
|
md.metadata_set.assert_called_once_with(expected_md)
|
||||||
|
|
||||||
def test_loadbalancer_validate_hchk_good(self):
|
def test_loadbalancer_validate_hchk_good(self):
|
||||||
rsrc = self.setup_loadbalancer()
|
|
||||||
rsrc._parse_nested_stack = mock.Mock()
|
|
||||||
hc = {
|
hc = {
|
||||||
'Target': 'HTTP:80/',
|
'Target': 'HTTP:80/',
|
||||||
'HealthyThreshold': '3',
|
'HealthyThreshold': '3',
|
||||||
'UnhealthyThreshold': '5',
|
'UnhealthyThreshold': '5',
|
||||||
'Interval': '30',
|
'Interval': '30',
|
||||||
'Timeout': '5'}
|
'Timeout': '5'}
|
||||||
rsrc.t['Properties']['HealthCheck'] = hc
|
rsrc = self.setup_loadbalancer(hc=hc)
|
||||||
|
rsrc._parse_nested_stack = mock.Mock()
|
||||||
self.assertIsNone(rsrc.validate())
|
self.assertIsNone(rsrc.validate())
|
||||||
|
|
||||||
def test_loadbalancer_validate_hchk_int_gt_tmo(self):
|
def test_loadbalancer_validate_hchk_int_gt_tmo(self):
|
||||||
rsrc = self.setup_loadbalancer()
|
|
||||||
rsrc._parse_nested_stack = mock.Mock()
|
|
||||||
hc = {
|
hc = {
|
||||||
'Target': 'HTTP:80/',
|
'Target': 'HTTP:80/',
|
||||||
'HealthyThreshold': '3',
|
'HealthyThreshold': '3',
|
||||||
'UnhealthyThreshold': '5',
|
'UnhealthyThreshold': '5',
|
||||||
'Interval': '30',
|
'Interval': '30',
|
||||||
'Timeout': '35'}
|
'Timeout': '35'}
|
||||||
rsrc.t['Properties']['HealthCheck'] = hc
|
rsrc = self.setup_loadbalancer(hc=hc)
|
||||||
|
rsrc._parse_nested_stack = mock.Mock()
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
{'Error': 'Interval must be larger than Timeout'},
|
{'Error': 'Interval must be larger than Timeout'},
|
||||||
rsrc.validate())
|
rsrc.validate())
|
||||||
@ -159,12 +157,15 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
rsrc = self.setup_loadbalancer()
|
rsrc = self.setup_loadbalancer()
|
||||||
self.assertRaises(exception.StackValidationFailed, rsrc.validate)
|
self.assertRaises(exception.StackValidationFailed, rsrc.validate)
|
||||||
|
|
||||||
def setup_loadbalancer(self, include_magic=True, cache_data=None):
|
def setup_loadbalancer(self, include_magic=True, cache_data=None, hc=None):
|
||||||
template = template_format.parse(lb_template)
|
template = template_format.parse(lb_template)
|
||||||
if not include_magic:
|
if not include_magic:
|
||||||
del template['Parameters']['KeyName']
|
del template['Parameters']['KeyName']
|
||||||
del template['Parameters']['LbFlavor']
|
del template['Parameters']['LbFlavor']
|
||||||
del template['Parameters']['LbImageId']
|
del template['Parameters']['LbImageId']
|
||||||
|
if hc is not None:
|
||||||
|
props = template['Resources']['LoadBalancer']['Properties']
|
||||||
|
props['HealthCheck'] = hc
|
||||||
self.stack = utils.parse_stack(template, cache_data=cache_data)
|
self.stack = utils.parse_stack(template, cache_data=cache_data)
|
||||||
|
|
||||||
resource_name = 'LoadBalancer'
|
resource_name = 'LoadBalancer'
|
||||||
|
@ -192,7 +192,7 @@ def setup_mocks(mocks, stack, mock_image_constraint=True,
|
|||||||
metadata = instance.metadata_get()
|
metadata = instance.metadata_get()
|
||||||
if mock_image_constraint:
|
if mock_image_constraint:
|
||||||
setup_mock_for_image_constraint(mocks,
|
setup_mock_for_image_constraint(mocks,
|
||||||
instance.t['Properties']['ImageId'])
|
instance.properties['ImageId'])
|
||||||
|
|
||||||
if mock_keystone:
|
if mock_keystone:
|
||||||
setup_keystone_mocks(mocks, stack)
|
setup_keystone_mocks(mocks, stack)
|
||||||
@ -203,7 +203,7 @@ def setup_mocks(mocks, stack, mock_image_constraint=True,
|
|||||||
mocks.StubOutWithMock(nova.NovaClientPlugin, 'build_userdata')
|
mocks.StubOutWithMock(nova.NovaClientPlugin, 'build_userdata')
|
||||||
nova.NovaClientPlugin.build_userdata(
|
nova.NovaClientPlugin.build_userdata(
|
||||||
metadata,
|
metadata,
|
||||||
instance.t['Properties']['UserData'],
|
user_data,
|
||||||
'ec2-user').AndReturn(server_userdata)
|
'ec2-user').AndReturn(server_userdata)
|
||||||
|
|
||||||
mocks.StubOutWithMock(fc.servers, 'create')
|
mocks.StubOutWithMock(fc.servers, 'create')
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import copy
|
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
import six
|
import six
|
||||||
|
|
||||||
@ -87,8 +85,10 @@ class TestOrder(common.HeatTestCase):
|
|||||||
self.assertEqual(256, args['bit_length'])
|
self.assertEqual(256, args['bit_length'])
|
||||||
|
|
||||||
def test_create_order_without_type_fail(self):
|
def test_create_order_without_type_fail(self):
|
||||||
snippet = copy.deepcopy(self.res_template)
|
props = self.props.copy()
|
||||||
del snippet['Properties']['type']
|
del props['type']
|
||||||
|
snippet = self.res_template.freeze(properties=props)
|
||||||
|
|
||||||
self.assertRaisesRegexp(exception.ResourceFailure,
|
self.assertRaisesRegexp(exception.ResourceFailure,
|
||||||
'Property type not assigned',
|
'Property type not assigned',
|
||||||
self._create_resource,
|
self._create_resource,
|
||||||
@ -96,9 +96,10 @@ class TestOrder(common.HeatTestCase):
|
|||||||
snippet, self.stack)
|
snippet, self.stack)
|
||||||
|
|
||||||
def test_validate_non_certificate_order(self):
|
def test_validate_non_certificate_order(self):
|
||||||
snippet = copy.deepcopy(self.res_template)
|
props = self.props.copy()
|
||||||
del snippet['Properties']['bit_length']
|
del props['bit_length']
|
||||||
del snippet['Properties']['algorithm']
|
del props['algorithm']
|
||||||
|
snippet = self.res_template.freeze(properties=props)
|
||||||
res = self._create_resource('test', snippet, self.stack)
|
res = self._create_resource('test', snippet, self.stack)
|
||||||
msg = ("Properties algorithm and bit_length are required for "
|
msg = ("Properties algorithm and bit_length are required for "
|
||||||
"key type of order.")
|
"key type of order.")
|
||||||
@ -107,9 +108,10 @@ class TestOrder(common.HeatTestCase):
|
|||||||
res.validate)
|
res.validate)
|
||||||
|
|
||||||
def test_validate_certificate_with_profile_without_ca_id(self):
|
def test_validate_certificate_with_profile_without_ca_id(self):
|
||||||
snippet = copy.deepcopy(self.res_template)
|
props = self.props.copy()
|
||||||
snippet['Properties']['profile'] = 'cert'
|
props['profile'] = 'cert'
|
||||||
snippet['Properties']['type'] = 'certificate'
|
props['type'] = 'certificate'
|
||||||
|
snippet = self.res_template.freeze(properties=props)
|
||||||
res = self._create_resource('test', snippet, self.stack)
|
res = self._create_resource('test', snippet, self.stack)
|
||||||
msg = ("profile cannot be specified without ca_id.")
|
msg = ("profile cannot be specified without ca_id.")
|
||||||
self.assertRaisesRegexp(exception.ResourcePropertyDependency,
|
self.assertRaisesRegexp(exception.ResourcePropertyDependency,
|
||||||
@ -117,8 +119,9 @@ class TestOrder(common.HeatTestCase):
|
|||||||
res.validate)
|
res.validate)
|
||||||
|
|
||||||
def test_key_order_validation_fail(self):
|
def test_key_order_validation_fail(self):
|
||||||
snippet = copy.deepcopy(self.res_template)
|
props = self.props.copy()
|
||||||
snippet['Properties']['pass_phrase'] = "something"
|
props['pass_phrase'] = "something"
|
||||||
|
snippet = self.res_template.freeze(properties=props)
|
||||||
res = self._create_resource('test', snippet, self.stack)
|
res = self._create_resource('test', snippet, self.stack)
|
||||||
msg = ("Unexpected properties: pass_phrase. Only these properties "
|
msg = ("Unexpected properties: pass_phrase. Only these properties "
|
||||||
"are allowed for key type of order: algorithm, "
|
"are allowed for key type of order: algorithm, "
|
||||||
@ -128,8 +131,9 @@ class TestOrder(common.HeatTestCase):
|
|||||||
res.validate)
|
res.validate)
|
||||||
|
|
||||||
def test_certificate_validation_fail(self):
|
def test_certificate_validation_fail(self):
|
||||||
snippet = copy.deepcopy(self.res_template)
|
props = self.props.copy()
|
||||||
snippet['Properties']['type'] = 'certificate'
|
props['type'] = 'certificate'
|
||||||
|
snippet = self.res_template.freeze(properties=props)
|
||||||
res = self._create_resource('test', snippet, self.stack)
|
res = self._create_resource('test', snippet, self.stack)
|
||||||
msg = ("Unexpected properties: algorithm, bit_length, mode. Only "
|
msg = ("Unexpected properties: algorithm, bit_length, mode. Only "
|
||||||
"these properties are allowed for certificate type of order: "
|
"these properties are allowed for certificate type of order: "
|
||||||
@ -140,9 +144,10 @@ class TestOrder(common.HeatTestCase):
|
|||||||
res.validate)
|
res.validate)
|
||||||
|
|
||||||
def test_asymmetric_order_validation_fail(self):
|
def test_asymmetric_order_validation_fail(self):
|
||||||
snippet = copy.deepcopy(self.res_template)
|
props = self.props.copy()
|
||||||
snippet['Properties']['type'] = 'asymmetric'
|
props['type'] = 'asymmetric'
|
||||||
snippet['Properties']['subject_dn'] = 'asymmetric'
|
props['subject_dn'] = 'asymmetric'
|
||||||
|
snippet = self.res_template.freeze(properties=props)
|
||||||
res = self._create_resource('test', snippet, self.stack)
|
res = self._create_resource('test', snippet, self.stack)
|
||||||
msg = ("Unexpected properties: subject_dn. Only these properties are "
|
msg = ("Unexpected properties: subject_dn. Only these properties are "
|
||||||
"allowed for asymmetric type of order: algorithm, bit_length, "
|
"allowed for asymmetric type of order: algorithm, bit_length, "
|
||||||
|
@ -668,8 +668,8 @@ class CombinationAlarmTest(common.HeatTestCase):
|
|||||||
time_constraints=[],
|
time_constraints=[],
|
||||||
severity='low'
|
severity='low'
|
||||||
).AndReturn(FakeCeilometerAlarm())
|
).AndReturn(FakeCeilometerAlarm())
|
||||||
snippet = template_format.parse(combination_alarm_template)
|
self.tmpl = template_format.parse(combination_alarm_template)
|
||||||
self.stack = utils.parse_stack(snippet)
|
self.stack = utils.parse_stack(self.tmpl)
|
||||||
resource_defns = self.stack.t.resource_definitions(self.stack)
|
resource_defns = self.stack.t.resource_definitions(self.stack)
|
||||||
return alarm.CombinationAlarm(
|
return alarm.CombinationAlarm(
|
||||||
'CombinAlarm', resource_defns['CombinAlarm'], self.stack)
|
'CombinAlarm', resource_defns['CombinAlarm'], self.stack)
|
||||||
@ -707,8 +707,9 @@ class CombinationAlarmTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = self.tmpl['Resources']['CombinAlarm']['Properties'].copy()
|
||||||
update_template['Properties']['alarm_ids'] = ['alarm1', 'alarm3']
|
props['alarm_ids'] = ['alarm1', 'alarm3']
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||||
self.assertEqual((rsrc.UPDATE, rsrc.COMPLETE), rsrc.state)
|
self.assertEqual((rsrc.UPDATE, rsrc.COMPLETE), rsrc.state)
|
||||||
|
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import copy
|
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
import mox
|
import mox
|
||||||
|
|
||||||
@ -121,8 +119,8 @@ class GnocchiResourcesAlarmTest(common.HeatTestCase):
|
|||||||
time_constraints=[],
|
time_constraints=[],
|
||||||
severity='low',
|
severity='low',
|
||||||
).AndReturn(FakeCeilometerAlarm())
|
).AndReturn(FakeCeilometerAlarm())
|
||||||
snippet = template_format.parse(gnocchi_resources_alarm_template)
|
self.tmpl = template_format.parse(gnocchi_resources_alarm_template)
|
||||||
self.stack = utils.parse_stack(snippet)
|
self.stack = utils.parse_stack(self.tmpl)
|
||||||
resource_defns = self.stack.t.resource_definitions(self.stack)
|
resource_defns = self.stack.t.resource_definitions(self.stack)
|
||||||
return gnocchi.CeilometerGnocchiResourcesAlarm(
|
return gnocchi.CeilometerGnocchiResourcesAlarm(
|
||||||
'GnoResAlarm', resource_defns['GnoResAlarm'], self.stack)
|
'GnoResAlarm', resource_defns['GnoResAlarm'], self.stack)
|
||||||
@ -138,9 +136,9 @@ class GnocchiResourcesAlarmTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = self.tmpl['resources']['GnoResAlarm']['properties']
|
||||||
update_template['Properties']['resource_id'] = (
|
props['resource_id'] = 'd3d6c642-921e-4fc2-9c5f-15d9a5afb598'
|
||||||
'd3d6c642-921e-4fc2-9c5f-15d9a5afb598')
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||||
self.assertEqual((rsrc.UPDATE, rsrc.COMPLETE), rsrc.state)
|
self.assertEqual((rsrc.UPDATE, rsrc.COMPLETE), rsrc.state)
|
||||||
|
|
||||||
@ -242,9 +240,9 @@ class GnocchiAggregationByMetricsAlarmTest(GnocchiResourcesAlarmTest):
|
|||||||
time_constraints=[],
|
time_constraints=[],
|
||||||
severity='low',
|
severity='low',
|
||||||
).AndReturn(FakeCeilometerAlarm())
|
).AndReturn(FakeCeilometerAlarm())
|
||||||
snippet = template_format.parse(
|
self.tmpl = template_format.parse(
|
||||||
gnocchi_aggregation_by_metrics_alarm_template)
|
gnocchi_aggregation_by_metrics_alarm_template)
|
||||||
self.stack = utils.parse_stack(snippet)
|
self.stack = utils.parse_stack(self.tmpl)
|
||||||
resource_defns = self.stack.t.resource_definitions(self.stack)
|
resource_defns = self.stack.t.resource_definitions(self.stack)
|
||||||
return gnocchi.CeilometerGnocchiAggregationByMetricsAlarm(
|
return gnocchi.CeilometerGnocchiAggregationByMetricsAlarm(
|
||||||
'GnoAggregationByMetricsAlarm',
|
'GnoAggregationByMetricsAlarm',
|
||||||
@ -262,10 +260,11 @@ class GnocchiAggregationByMetricsAlarmTest(GnocchiResourcesAlarmTest):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
snippet = self.tmpl['resources']['GnoAggregationByMetricsAlarm']
|
||||||
update_template['Properties']['metrics'] = [
|
props = snippet['properties'].copy()
|
||||||
'd3d6c642-921e-4fc2-9c5f-15d9a5afb598',
|
props['metrics'] = ['d3d6c642-921e-4fc2-9c5f-15d9a5afb598',
|
||||||
'bc60f822-18a0-4a0c-94e7-94c554b00901']
|
'bc60f822-18a0-4a0c-94e7-94c554b00901']
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||||
self.assertEqual((rsrc.UPDATE, rsrc.COMPLETE), rsrc.state)
|
self.assertEqual((rsrc.UPDATE, rsrc.COMPLETE), rsrc.state)
|
||||||
|
|
||||||
@ -319,9 +318,9 @@ class GnocchiAggregationByResourcesAlarmTest(GnocchiResourcesAlarmTest):
|
|||||||
time_constraints=[],
|
time_constraints=[],
|
||||||
severity='low',
|
severity='low',
|
||||||
).AndReturn(FakeCeilometerAlarm())
|
).AndReturn(FakeCeilometerAlarm())
|
||||||
snippet = template_format.parse(
|
self.tmpl = template_format.parse(
|
||||||
gnocchi_aggregation_by_resources_alarm_template)
|
gnocchi_aggregation_by_resources_alarm_template)
|
||||||
self.stack = utils.parse_stack(snippet)
|
self.stack = utils.parse_stack(self.tmpl)
|
||||||
resource_defns = self.stack.t.resource_definitions(self.stack)
|
resource_defns = self.stack.t.resource_definitions(self.stack)
|
||||||
return gnocchi.CeilometerGnocchiAggregationByResourcesAlarm(
|
return gnocchi.CeilometerGnocchiAggregationByResourcesAlarm(
|
||||||
'GnoAggregationByResourcesAlarm',
|
'GnoAggregationByResourcesAlarm',
|
||||||
@ -338,9 +337,10 @@ class GnocchiAggregationByResourcesAlarmTest(GnocchiResourcesAlarmTest):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
snippet = self.tmpl['resources']['GnoAggregationByResourcesAlarm']
|
||||||
update_template['Properties']['query'] = (
|
props = snippet['properties'].copy()
|
||||||
'{"=": {"server_group": "my_new_group"}}')
|
props['query'] = '{"=": {"server_group": "my_new_group"}}'
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||||
self.assertEqual((rsrc.UPDATE, rsrc.COMPLETE), rsrc.state)
|
self.assertEqual((rsrc.UPDATE, rsrc.COMPLETE), rsrc.state)
|
||||||
|
|
||||||
|
@ -61,12 +61,16 @@ class CinderVolumeTypeTest(common.HeatTestCase):
|
|||||||
volume_type_id = '927202df-1afb-497f-8368-9c2d2f26e5db'
|
volume_type_id = '927202df-1afb-497f-8368-9c2d2f26e5db'
|
||||||
value.id = volume_type_id
|
value.id = volume_type_id
|
||||||
self.volume_types.create.return_value = value
|
self.volume_types.create.return_value = value
|
||||||
self.my_volume_type.t['Properties']['is_public'] = is_public
|
tmpl = self.stack.t.t
|
||||||
|
props = tmpl['resources']['my_volume_type']['properties'].copy()
|
||||||
|
props['is_public'] = is_public
|
||||||
if projects:
|
if projects:
|
||||||
self.my_volume_type.t['Properties']['projects'] = projects
|
props['projects'] = projects
|
||||||
project = collections.namedtuple('Project', ['id'])
|
project = collections.namedtuple('Project', ['id'])
|
||||||
stub_projects = [project(p) for p in projects]
|
stub_projects = [project(p) for p in projects]
|
||||||
self.project_list.side_effect = [p for p in stub_projects]
|
self.project_list.side_effect = [p for p in stub_projects]
|
||||||
|
self.my_volume_type.t = self.my_volume_type.t.freeze(properties=props)
|
||||||
|
self.my_volume_type.reparse()
|
||||||
self.my_volume_type.handle_create()
|
self.my_volume_type.handle_create()
|
||||||
self.volume_types.create.assert_called_once_with(
|
self.volume_types.create.assert_called_once_with(
|
||||||
name='volumeBackend', is_public=is_public, description=None)
|
name='volumeBackend', is_public=is_public, description=None)
|
||||||
@ -166,8 +170,12 @@ class CinderVolumeTypeTest(common.HeatTestCase):
|
|||||||
self.my_volume_type.resource_id, 'id3')
|
self.my_volume_type.resource_id, 'id3')
|
||||||
|
|
||||||
def test_validate_projects_in_v1(self):
|
def test_validate_projects_in_v1(self):
|
||||||
self.my_volume_type.t['Properties']['is_public'] = False
|
tmpl = self.stack.t.t
|
||||||
self.my_volume_type.t['Properties']['projects'] = ['id1']
|
props = tmpl['resources']['my_volume_type']['properties'].copy()
|
||||||
|
props['is_public'] = False
|
||||||
|
props['projects'] = ['id1']
|
||||||
|
self.my_volume_type.t = self.my_volume_type.t.freeze(properties=props)
|
||||||
|
self.my_volume_type.reparse()
|
||||||
self.cinderclient.volume_api_version = 1
|
self.cinderclient.volume_api_version = 1
|
||||||
self.stub_KeystoneProjectConstraint()
|
self.stub_KeystoneProjectConstraint()
|
||||||
ex = self.assertRaises(exception.NotSupported,
|
ex = self.assertRaises(exception.NotSupported,
|
||||||
@ -176,8 +184,12 @@ class CinderVolumeTypeTest(common.HeatTestCase):
|
|||||||
self.assertEqual(expected, six.text_type(ex))
|
self.assertEqual(expected, six.text_type(ex))
|
||||||
|
|
||||||
def test_validate_projects_when_public(self):
|
def test_validate_projects_when_public(self):
|
||||||
self.my_volume_type.t['Properties']['projects'] = ['id1']
|
tmpl = self.stack.t.t
|
||||||
self.my_volume_type.t['Properties']['is_public'] = True
|
props = tmpl['resources']['my_volume_type']['properties'].copy()
|
||||||
|
props['is_public'] = True
|
||||||
|
props['projects'] = ['id1']
|
||||||
|
self.my_volume_type.t = self.my_volume_type.t.freeze(properties=props)
|
||||||
|
self.my_volume_type.reparse()
|
||||||
self.cinderclient.volume_api_version = 2
|
self.cinderclient.volume_api_version = 2
|
||||||
self.stub_KeystoneProjectConstraint()
|
self.stub_KeystoneProjectConstraint()
|
||||||
ex = self.assertRaises(exception.StackValidationFailed,
|
ex = self.assertRaises(exception.StackValidationFailed,
|
||||||
@ -187,8 +199,12 @@ class CinderVolumeTypeTest(common.HeatTestCase):
|
|||||||
self.assertEqual(expected, six.text_type(ex))
|
self.assertEqual(expected, six.text_type(ex))
|
||||||
|
|
||||||
def test_validate_projects_when_private(self):
|
def test_validate_projects_when_private(self):
|
||||||
self.my_volume_type.t['Properties']['projects'] = ['id1']
|
tmpl = self.stack.t.t
|
||||||
self.my_volume_type.t['Properties']['is_public'] = False
|
props = tmpl['resources']['my_volume_type']['properties'].copy()
|
||||||
|
props['is_public'] = False
|
||||||
|
props['projects'] = ['id1']
|
||||||
|
self.my_volume_type.t = self.my_volume_type.t.freeze(properties=props)
|
||||||
|
self.my_volume_type.reparse()
|
||||||
self.cinderclient.volume_api_version = 2
|
self.cinderclient.volume_api_version = 2
|
||||||
self.stub_KeystoneProjectConstraint()
|
self.stub_KeystoneProjectConstraint()
|
||||||
self.assertIsNone(self.my_volume_type.validate())
|
self.assertIsNone(self.my_volume_type.validate())
|
||||||
|
@ -86,7 +86,10 @@ class GlanceImageTest(common.HeatTestCase):
|
|||||||
template.Template(tpl)
|
template.Template(tpl)
|
||||||
)
|
)
|
||||||
image = stack['image']
|
image = stack['image']
|
||||||
image.t['Properties']['min_disk'] = -1
|
props = stack.t.t['resources']['image']['properties'].copy()
|
||||||
|
props['min_disk'] = -1
|
||||||
|
image.t = image.t.freeze(properties=props)
|
||||||
|
image.reparse()
|
||||||
error_msg = ('Property error: resources.image.properties.min_disk: '
|
error_msg = ('Property error: resources.image.properties.min_disk: '
|
||||||
'-1 is out of range (min: 0, max: None)')
|
'-1 is out of range (min: 0, max: None)')
|
||||||
self._test_validate(image, error_msg)
|
self._test_validate(image, error_msg)
|
||||||
@ -99,7 +102,10 @@ class GlanceImageTest(common.HeatTestCase):
|
|||||||
template.Template(tpl)
|
template.Template(tpl)
|
||||||
)
|
)
|
||||||
image = stack['image']
|
image = stack['image']
|
||||||
image.t['Properties']['min_ram'] = -1
|
props = stack.t.t['resources']['image']['properties'].copy()
|
||||||
|
props['min_ram'] = -1
|
||||||
|
image.t = image.t.freeze(properties=props)
|
||||||
|
image.reparse()
|
||||||
error_msg = ('Property error: resources.image.properties.min_ram: '
|
error_msg = ('Property error: resources.image.properties.min_ram: '
|
||||||
'-1 is out of range (min: 0, max: None)')
|
'-1 is out of range (min: 0, max: None)')
|
||||||
self._test_validate(image, error_msg)
|
self._test_validate(image, error_msg)
|
||||||
@ -112,7 +118,10 @@ class GlanceImageTest(common.HeatTestCase):
|
|||||||
template.Template(tpl)
|
template.Template(tpl)
|
||||||
)
|
)
|
||||||
image = stack['image']
|
image = stack['image']
|
||||||
image.t['Properties'].pop('disk_format')
|
props = stack.t.t['resources']['image']['properties'].copy()
|
||||||
|
del props['disk_format']
|
||||||
|
image.t = image.t.freeze(properties=props)
|
||||||
|
image.reparse()
|
||||||
error_msg = 'Property disk_format not assigned'
|
error_msg = 'Property disk_format not assigned'
|
||||||
self._test_validate(image, error_msg)
|
self._test_validate(image, error_msg)
|
||||||
|
|
||||||
@ -124,7 +133,10 @@ class GlanceImageTest(common.HeatTestCase):
|
|||||||
template.Template(tpl)
|
template.Template(tpl)
|
||||||
)
|
)
|
||||||
image = stack['image']
|
image = stack['image']
|
||||||
image.t['Properties']['disk_format'] = 'incorrect_format'
|
props = stack.t.t['resources']['image']['properties'].copy()
|
||||||
|
props['disk_format'] = 'incorrect_format'
|
||||||
|
image.t = image.t.freeze(properties=props)
|
||||||
|
image.reparse()
|
||||||
error_msg = ('Property error: '
|
error_msg = ('Property error: '
|
||||||
'resources.image.properties.disk_format: '
|
'resources.image.properties.disk_format: '
|
||||||
'"incorrect_format" is not an allowed value '
|
'"incorrect_format" is not an allowed value '
|
||||||
@ -139,7 +151,10 @@ class GlanceImageTest(common.HeatTestCase):
|
|||||||
template.Template(tpl)
|
template.Template(tpl)
|
||||||
)
|
)
|
||||||
image = stack['image']
|
image = stack['image']
|
||||||
image.t['Properties'].pop('container_format')
|
props = stack.t.t['resources']['image']['properties'].copy()
|
||||||
|
del props['container_format']
|
||||||
|
image.t = image.t.freeze(properties=props)
|
||||||
|
image.reparse()
|
||||||
error_msg = 'Property container_format not assigned'
|
error_msg = 'Property container_format not assigned'
|
||||||
self._test_validate(image, error_msg)
|
self._test_validate(image, error_msg)
|
||||||
|
|
||||||
@ -151,7 +166,10 @@ class GlanceImageTest(common.HeatTestCase):
|
|||||||
template.Template(tpl)
|
template.Template(tpl)
|
||||||
)
|
)
|
||||||
image = stack['image']
|
image = stack['image']
|
||||||
image.t['Properties']['container_format'] = 'incorrect_format'
|
props = stack.t.t['resources']['image']['properties'].copy()
|
||||||
|
props['container_format'] = 'incorrect_format'
|
||||||
|
image.t = image.t.freeze(properties=props)
|
||||||
|
image.reparse()
|
||||||
error_msg = ('Property error: '
|
error_msg = ('Property error: '
|
||||||
'resources.image.properties.container_format: '
|
'resources.image.properties.container_format: '
|
||||||
'"incorrect_format" is not an allowed value '
|
'"incorrect_format" is not an allowed value '
|
||||||
@ -166,7 +184,10 @@ class GlanceImageTest(common.HeatTestCase):
|
|||||||
template.Template(tpl)
|
template.Template(tpl)
|
||||||
)
|
)
|
||||||
image = stack['image']
|
image = stack['image']
|
||||||
image.t['Properties'].pop('location')
|
props = stack.t.t['resources']['image']['properties'].copy()
|
||||||
|
del props['location']
|
||||||
|
image.t = image.t.freeze(properties=props)
|
||||||
|
image.reparse()
|
||||||
error_msg = 'Property location not assigned'
|
error_msg = 'Property location not assigned'
|
||||||
self._test_validate(image, error_msg)
|
self._test_validate(image, error_msg)
|
||||||
|
|
||||||
@ -177,8 +198,11 @@ class GlanceImageTest(common.HeatTestCase):
|
|||||||
template.Template(tpl)
|
template.Template(tpl)
|
||||||
)
|
)
|
||||||
image = stack['image']
|
image = stack['image']
|
||||||
image.t['Properties']['disk_format'] = 'raw'
|
props = stack.t.t['resources']['image']['properties'].copy()
|
||||||
image.t['Properties']['container_format'] = 'ari'
|
props['disk_format'] = 'raw'
|
||||||
|
props['container_format'] = 'ari'
|
||||||
|
image.t = image.t.freeze(properties=props)
|
||||||
|
image.reparse()
|
||||||
error_msg = ("Invalid mix of disk and container formats. When "
|
error_msg = ("Invalid mix of disk and container formats. When "
|
||||||
"setting a disk or container format to one of 'aki', "
|
"setting a disk or container format to one of 'aki', "
|
||||||
"'ari', or 'ami', the container and disk formats must "
|
"'ari', or 'ami', the container and disk formats must "
|
||||||
|
@ -245,23 +245,14 @@ class InstanceGroupTest(common.HeatTestCase):
|
|||||||
# identify the template difference
|
# identify the template difference
|
||||||
tmpl_diff = updated_grp.update_template_diff(
|
tmpl_diff = updated_grp.update_template_diff(
|
||||||
updated_grp_json, current_grp_json)
|
updated_grp_json, current_grp_json)
|
||||||
updated_policy = (updated_grp.t['UpdatePolicy']
|
|
||||||
if 'UpdatePolicy' in updated_grp.t else None)
|
|
||||||
self.assertTrue(tmpl_diff.update_policy_changed())
|
self.assertTrue(tmpl_diff.update_policy_changed())
|
||||||
|
|
||||||
# test application of the new update policy in handle_update
|
# test application of the new update policy in handle_update
|
||||||
update_snippet = rsrc_defn.ResourceDefinition(
|
|
||||||
current_grp.name,
|
|
||||||
current_grp.type(),
|
|
||||||
properties=updated_grp.t['Properties'],
|
|
||||||
update_policy=updated_policy)
|
|
||||||
current_grp._try_rolling_update = mock.MagicMock()
|
current_grp._try_rolling_update = mock.MagicMock()
|
||||||
current_grp.resize = mock.MagicMock()
|
current_grp.resize = mock.MagicMock()
|
||||||
current_grp.handle_update(update_snippet, tmpl_diff, None)
|
current_grp.handle_update(updated_grp_json, tmpl_diff, None)
|
||||||
if updated_policy is None:
|
self.assertEqual(updated_grp_json._update_policy or {},
|
||||||
self.assertEqual({}, current_grp.update_policy.data)
|
current_grp.update_policy.data)
|
||||||
else:
|
|
||||||
self.assertEqual(updated_policy, current_grp.update_policy.data)
|
|
||||||
|
|
||||||
def test_update_policy_added(self):
|
def test_update_policy_added(self):
|
||||||
self.validate_update_policy_diff(ig_tmpl_without_updt_policy,
|
self.validate_update_policy_diff(ig_tmpl_without_updt_policy,
|
||||||
|
@ -407,11 +407,15 @@ class ResourceGroupTest(common.HeatTestCase):
|
|||||||
res_prop['listprop'] = list(res_prop['listprop'])
|
res_prop['listprop'] = list(res_prop['listprop'])
|
||||||
self.assertEqual(expect, nested)
|
self.assertEqual(expect, nested)
|
||||||
|
|
||||||
res_def = snip['Properties']['resource_def']
|
props = copy.deepcopy(templ['resources']['group1']['properties'])
|
||||||
|
res_def = props['resource_def']
|
||||||
res_def['properties']['Foo'] = "Bar___foo__"
|
res_def['properties']['Foo'] = "Bar___foo__"
|
||||||
res_def['properties']['listprop'] = ["__foo___0", "__foo___1",
|
res_def['properties']['listprop'] = ["__foo___0",
|
||||||
|
"__foo___1",
|
||||||
"__foo___2"]
|
"__foo___2"]
|
||||||
res_def['type'] = "ResourceWithListProp__foo__"
|
res_def['type'] = "ResourceWithListProp__foo__"
|
||||||
|
snip = snip.freeze(properties=props)
|
||||||
|
|
||||||
resg = resource_group.ResourceGroup('test', snip, stack)
|
resg = resource_group.ResourceGroup('test', snip, stack)
|
||||||
expect = {
|
expect = {
|
||||||
"heat_template_version": "2015-04-30",
|
"heat_template_version": "2015-04-30",
|
||||||
@ -517,9 +521,11 @@ class ResourceGroupTest(common.HeatTestCase):
|
|||||||
|
|
||||||
def test_handle_create_with_batching(self):
|
def test_handle_create_with_batching(self):
|
||||||
stack = utils.parse_stack(tmpl_with_default_updt_policy())
|
stack = utils.parse_stack(tmpl_with_default_updt_policy())
|
||||||
snip = stack.t.resource_definitions(stack)['group1']
|
defn = stack.t.resource_definitions(stack)['group1']
|
||||||
snip['UpdatePolicy']['batch_create'] = {'max_batch_size': 3}
|
props = stack.t.t['resources']['group1']['properties'].copy()
|
||||||
snip['Properties']['count'] = 10
|
props['count'] = 10
|
||||||
|
update_policy = {'batch_create': {'max_batch_size': 3}}
|
||||||
|
snip = defn.freeze(properties=props, update_policy=update_policy)
|
||||||
resgrp = resource_group.ResourceGroup('test', snip, stack)
|
resgrp = resource_group.ResourceGroup('test', snip, stack)
|
||||||
self.patchobject(scheduler.TaskRunner, 'start')
|
self.patchobject(scheduler.TaskRunner, 'start')
|
||||||
checkers = resgrp.handle_create()
|
checkers = resgrp.handle_create()
|
||||||
@ -1019,25 +1025,15 @@ class RollingUpdatePolicyDiffTest(common.HeatTestCase):
|
|||||||
# identify the template difference
|
# identify the template difference
|
||||||
tmpl_diff = updated_grp.update_template_diff(
|
tmpl_diff = updated_grp.update_template_diff(
|
||||||
updated_grp_json, current_grp_json)
|
updated_grp_json, current_grp_json)
|
||||||
updated_policy = (updated_grp_json['UpdatePolicy']
|
|
||||||
if 'UpdatePolicy' in updated_grp_json else None)
|
|
||||||
self.assertTrue(tmpl_diff.update_policy_changed())
|
self.assertTrue(tmpl_diff.update_policy_changed())
|
||||||
|
|
||||||
# test application of the new update policy in handle_update
|
# test application of the new update policy in handle_update
|
||||||
update_snippet = rsrc_defn.ResourceDefinition(
|
|
||||||
current_grp.name,
|
|
||||||
current_grp.type(),
|
|
||||||
properties=updated_grp_json['Properties'],
|
|
||||||
update_policy=updated_policy)
|
|
||||||
|
|
||||||
current_grp._try_rolling_update = mock.Mock()
|
current_grp._try_rolling_update = mock.Mock()
|
||||||
current_grp._assemble_nested_for_size = mock.Mock()
|
current_grp._assemble_nested_for_size = mock.Mock()
|
||||||
self.patchobject(scheduler.TaskRunner, 'start')
|
self.patchobject(scheduler.TaskRunner, 'start')
|
||||||
current_grp.handle_update(update_snippet, tmpl_diff, None)
|
current_grp.handle_update(updated_grp_json, tmpl_diff, None)
|
||||||
if updated_policy is None:
|
self.assertEqual(updated_grp_json._update_policy or {},
|
||||||
self.assertEqual({}, current_grp.update_policy.data)
|
current_grp.update_policy.data)
|
||||||
else:
|
|
||||||
self.assertEqual(updated_policy, current_grp.update_policy.data)
|
|
||||||
|
|
||||||
def test_update_policy_added(self):
|
def test_update_policy_added(self):
|
||||||
self.validate_update_policy_diff(template,
|
self.validate_update_policy_diff(template,
|
||||||
@ -1084,17 +1080,10 @@ class RollingUpdateTest(common.HeatTestCase):
|
|||||||
tmpl_diff = updated_grp.update_template_diff(
|
tmpl_diff = updated_grp.update_template_diff(
|
||||||
updated_grp_json, current_grp_json)
|
updated_grp_json, current_grp_json)
|
||||||
|
|
||||||
updated_policy = updated_grp_json[
|
|
||||||
'UpdatePolicy']if 'UpdatePolicy' in updated_grp_json else None
|
|
||||||
update_snippet = rsrc_defn.ResourceDefinition(
|
|
||||||
self.current_grp.name,
|
|
||||||
self.current_grp.type(),
|
|
||||||
properties=updated_grp_json['Properties'],
|
|
||||||
update_policy=updated_policy)
|
|
||||||
self.current_grp._replace = mock.Mock(return_value=[])
|
self.current_grp._replace = mock.Mock(return_value=[])
|
||||||
self.current_grp._assemble_nested = mock.Mock()
|
self.current_grp._assemble_nested = mock.Mock()
|
||||||
self.patchobject(scheduler.TaskRunner, 'start')
|
self.patchobject(scheduler.TaskRunner, 'start')
|
||||||
self.current_grp.handle_update(update_snippet, tmpl_diff, prop_diff)
|
self.current_grp.handle_update(updated_grp_json, tmpl_diff, prop_diff)
|
||||||
|
|
||||||
def test_update_without_policy_prop_diff(self):
|
def test_update_without_policy_prop_diff(self):
|
||||||
self.check_with_update(with_diff=True)
|
self.check_with_update(with_diff=True)
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import copy
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from heat.engine import constraints
|
from heat.engine import constraints
|
||||||
@ -61,9 +63,15 @@ class KeystoneEndpointTest(common.HeatTestCase):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
def _setup_endpoint_resource(self, stack_name, use_default=False):
|
def _setup_endpoint_resource(self, stack_name, use_default=False):
|
||||||
|
tmpl_data = copy.deepcopy(keystone_endpoint_template)
|
||||||
|
if use_default:
|
||||||
|
props = tmpl_data['resources']['test_endpoint']['properties']
|
||||||
|
del props['name']
|
||||||
|
del props['enabled']
|
||||||
|
|
||||||
test_stack = stack.Stack(
|
test_stack = stack.Stack(
|
||||||
self.ctx, stack_name,
|
self.ctx, stack_name,
|
||||||
template.Template(keystone_endpoint_template)
|
template.Template(tmpl_data)
|
||||||
)
|
)
|
||||||
|
|
||||||
r_endpoint = test_stack['test_endpoint']
|
r_endpoint = test_stack['test_endpoint']
|
||||||
@ -72,10 +80,6 @@ class KeystoneEndpointTest(common.HeatTestCase):
|
|||||||
r_endpoint.client_plugin = mock.MagicMock()
|
r_endpoint.client_plugin = mock.MagicMock()
|
||||||
r_endpoint.client_plugin.return_value = self.keystone_client_plugin
|
r_endpoint.client_plugin.return_value = self.keystone_client_plugin
|
||||||
|
|
||||||
if use_default:
|
|
||||||
del r_endpoint.t['Properties']['name']
|
|
||||||
del r_endpoint.t['Properties']['enabled']
|
|
||||||
|
|
||||||
return r_endpoint
|
return r_endpoint
|
||||||
|
|
||||||
def test_endpoint_handle_create(self):
|
def test_endpoint_handle_create(self):
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import copy
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from heat.engine import properties
|
from heat.engine import properties
|
||||||
@ -52,9 +54,16 @@ class KeystoneServiceTest(common.HeatTestCase):
|
|||||||
self.keystone_client_plugin = mock.MagicMock()
|
self.keystone_client_plugin = mock.MagicMock()
|
||||||
|
|
||||||
def _setup_service_resource(self, stack_name, use_default=False):
|
def _setup_service_resource(self, stack_name, use_default=False):
|
||||||
|
tmpl_data = copy.deepcopy(keystone_service_template)
|
||||||
|
if use_default:
|
||||||
|
props = tmpl_data['resources']['test_service']['properties']
|
||||||
|
del props['name']
|
||||||
|
del props['enabled']
|
||||||
|
del props['description']
|
||||||
|
|
||||||
test_stack = stack.Stack(
|
test_stack = stack.Stack(
|
||||||
self.ctx, stack_name,
|
self.ctx, stack_name,
|
||||||
template.Template(keystone_service_template)
|
template.Template(tmpl_data)
|
||||||
)
|
)
|
||||||
r_service = test_stack['test_service']
|
r_service = test_stack['test_service']
|
||||||
r_service.client = mock.MagicMock()
|
r_service.client = mock.MagicMock()
|
||||||
@ -62,11 +71,6 @@ class KeystoneServiceTest(common.HeatTestCase):
|
|||||||
r_service.client_plugin = mock.MagicMock()
|
r_service.client_plugin = mock.MagicMock()
|
||||||
r_service.client_plugin.return_value = self.keystone_client_plugin
|
r_service.client_plugin.return_value = self.keystone_client_plugin
|
||||||
|
|
||||||
if use_default:
|
|
||||||
del r_service.t['Properties']['name']
|
|
||||||
del r_service.t['Properties']['enabled']
|
|
||||||
del r_service.t['Properties']['description']
|
|
||||||
|
|
||||||
return r_service
|
return r_service
|
||||||
|
|
||||||
def _get_mock_service(self):
|
def _get_mock_service(self):
|
||||||
|
@ -94,7 +94,7 @@ class ManilaSecurityServiceTest(common.HeatTestCase):
|
|||||||
self.client.security_services.get.return_value = value
|
self.client.security_services.get.return_value = value
|
||||||
scheduler.TaskRunner(ss.create)()
|
scheduler.TaskRunner(ss.create)()
|
||||||
args = self.client.security_services.create.call_args[1]
|
args = self.client.security_services.create.call_args[1]
|
||||||
self.assertEqual(self.rsrc_defn['Properties'], args)
|
self.assertEqual(self.rsrc_defn._properties, args)
|
||||||
self.assertEqual('12345', ss.resource_id)
|
self.assertEqual('12345', ss.resource_id)
|
||||||
return ss
|
return ss
|
||||||
|
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import copy
|
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from heat.common import exception
|
from heat.common import exception
|
||||||
@ -59,8 +57,8 @@ class ManilaShareNetworkTest(common.HeatTestCase):
|
|||||||
utils.setup_dummy_db()
|
utils.setup_dummy_db()
|
||||||
self.ctx = utils.dummy_context()
|
self.ctx = utils.dummy_context()
|
||||||
|
|
||||||
t = template_format.parse(stack_template)
|
self.tmpl = template_format.parse(stack_template)
|
||||||
self.stack = utils.parse_stack(t)
|
self.stack = utils.parse_stack(self.tmpl)
|
||||||
resource_defns = self.stack.t.resource_definitions(self.stack)
|
resource_defns = self.stack.t.resource_definitions(self.stack)
|
||||||
self.rsrc_defn = resource_defns['share_network']
|
self.rsrc_defn = resource_defns['share_network']
|
||||||
|
|
||||||
@ -150,12 +148,13 @@ class ManilaShareNetworkTest(common.HeatTestCase):
|
|||||||
|
|
||||||
def test_update(self):
|
def test_update(self):
|
||||||
net = self._create_network('share_network', self.rsrc_defn, self.stack)
|
net = self._create_network('share_network', self.rsrc_defn, self.stack)
|
||||||
update_template = copy.deepcopy(net.t)
|
props = self.tmpl['resources']['share_network']['properties'].copy()
|
||||||
update_template['Properties']['name'] = 'a'
|
props['name'] = 'a'
|
||||||
update_template['Properties']['description'] = 'b'
|
props['description'] = 'b'
|
||||||
update_template['Properties']['neutron_network'] = 'c'
|
props['neutron_network'] = 'c'
|
||||||
update_template['Properties']['neutron_subnet'] = 'd'
|
props['neutron_subnet'] = 'd'
|
||||||
update_template['Properties']['security_services'] = ['7', '8']
|
props['security_services'] = ['7', '8']
|
||||||
|
update_template = net.t.freeze(properties=props)
|
||||||
scheduler.TaskRunner(net.update, update_template)()
|
scheduler.TaskRunner(net.update, update_template)()
|
||||||
self.assertEqual((net.UPDATE, net.COMPLETE), net.state)
|
self.assertEqual((net.UPDATE, net.COMPLETE), net.state)
|
||||||
|
|
||||||
@ -174,8 +173,9 @@ class ManilaShareNetworkTest(common.HeatTestCase):
|
|||||||
|
|
||||||
def test_update_security_services(self):
|
def test_update_security_services(self):
|
||||||
net = self._create_network('share_network', self.rsrc_defn, self.stack)
|
net = self._create_network('share_network', self.rsrc_defn, self.stack)
|
||||||
update_template = copy.deepcopy(net.t)
|
props = self.tmpl['resources']['share_network']['properties'].copy()
|
||||||
update_template['Properties']['security_services'] = ['7', '8']
|
props['security_services'] = ['7', '8']
|
||||||
|
update_template = net.t.freeze(properties=props)
|
||||||
scheduler.TaskRunner(net.update, update_template)()
|
scheduler.TaskRunner(net.update, update_template)()
|
||||||
self.assertEqual((net.UPDATE, net.COMPLETE), net.state)
|
self.assertEqual((net.UPDATE, net.COMPLETE), net.state)
|
||||||
called = net.client().share_networks.update.called
|
called = net.client().share_networks.update.called
|
||||||
@ -189,8 +189,9 @@ class ManilaShareNetworkTest(common.HeatTestCase):
|
|||||||
net = self._create_network('share_network', self.rsrc_defn, self.stack)
|
net = self._create_network('share_network', self.rsrc_defn, self.stack)
|
||||||
self.client.share_networks.remove_security_service.side_effect = (
|
self.client.share_networks.remove_security_service.side_effect = (
|
||||||
Exception())
|
Exception())
|
||||||
update_template = copy.deepcopy(net.t)
|
props = self.tmpl['resources']['share_network']['properties'].copy()
|
||||||
update_template['Properties']['security_services'] = []
|
props['security_services'] = []
|
||||||
|
update_template = net.t.freeze(properties=props)
|
||||||
run = scheduler.TaskRunner(net.update, update_template)
|
run = scheduler.TaskRunner(net.update, update_template)
|
||||||
self.assertRaises(exception.ResourceFailure, run)
|
self.assertRaises(exception.ResourceFailure, run)
|
||||||
|
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import copy
|
|
||||||
|
|
||||||
from neutronclient.common import exceptions
|
from neutronclient.common import exceptions
|
||||||
from neutronclient.v2_0 import client as neutronclient
|
from neutronclient.v2_0 import client as neutronclient
|
||||||
import six
|
import six
|
||||||
@ -105,6 +103,7 @@ class FirewallTest(common.HeatTestCase):
|
|||||||
|
|
||||||
self.stack = utils.parse_stack(snippet)
|
self.stack = utils.parse_stack(snippet)
|
||||||
resource_defns = self.stack.t.resource_definitions(self.stack)
|
resource_defns = self.stack.t.resource_definitions(self.stack)
|
||||||
|
self.fw_props = snippet['resources']['firewall']['properties']
|
||||||
return firewall.Firewall(
|
return firewall.Firewall(
|
||||||
'firewall', resource_defns['firewall'], self.stack)
|
'firewall', resource_defns['firewall'], self.stack)
|
||||||
|
|
||||||
@ -211,8 +210,9 @@ class FirewallTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = self.fw_props.copy()
|
||||||
update_template['Properties']['admin_state_up'] = False
|
props['admin_state_up'] = False
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||||
|
|
||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
@ -256,6 +256,7 @@ class FirewallPolicyTest(common.HeatTestCase):
|
|||||||
|
|
||||||
snippet = template_format.parse(firewall_policy_template)
|
snippet = template_format.parse(firewall_policy_template)
|
||||||
self.stack = utils.parse_stack(snippet)
|
self.stack = utils.parse_stack(snippet)
|
||||||
|
self.tmpl = snippet
|
||||||
resource_defns = self.stack.t.resource_definitions(self.stack)
|
resource_defns = self.stack.t.resource_definitions(self.stack)
|
||||||
return firewall.FirewallPolicy(
|
return firewall.FirewallPolicy(
|
||||||
'firewall_policy', resource_defns['firewall_policy'], self.stack)
|
'firewall_policy', resource_defns['firewall_policy'], self.stack)
|
||||||
@ -358,8 +359,9 @@ class FirewallPolicyTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = self.tmpl['resources']['firewall_policy']['properties'].copy()
|
||||||
update_template['Properties']['firewall_rules'] = ['3', '4']
|
props['firewall_rules'] = ['3', '4']
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||||
|
|
||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
@ -386,6 +388,7 @@ class FirewallRuleTest(common.HeatTestCase):
|
|||||||
|
|
||||||
snippet = template_format.parse(firewall_rule_template)
|
snippet = template_format.parse(firewall_rule_template)
|
||||||
self.stack = utils.parse_stack(snippet)
|
self.stack = utils.parse_stack(snippet)
|
||||||
|
self.tmpl = snippet
|
||||||
resource_defns = self.stack.t.resource_definitions(self.stack)
|
resource_defns = self.stack.t.resource_definitions(self.stack)
|
||||||
return firewall.FirewallRule(
|
return firewall.FirewallRule(
|
||||||
'firewall_rule', resource_defns['firewall_rule'], self.stack)
|
'firewall_rule', resource_defns['firewall_rule'], self.stack)
|
||||||
@ -401,7 +404,10 @@ class FirewallRuleTest(common.HeatTestCase):
|
|||||||
snippet = template_format.parse(firewall_rule_template)
|
snippet = template_format.parse(firewall_rule_template)
|
||||||
stack = utils.parse_stack(snippet)
|
stack = utils.parse_stack(snippet)
|
||||||
rsrc = stack['firewall_rule']
|
rsrc = stack['firewall_rule']
|
||||||
rsrc.t['Properties']['protocol'] = 'None'
|
props = dict(rsrc.properties)
|
||||||
|
props['protocol'] = 'None'
|
||||||
|
rsrc.t = rsrc.t.freeze(properties=props)
|
||||||
|
rsrc.reparse()
|
||||||
self.assertRaises(exception.StackValidationFailed, rsrc.validate)
|
self.assertRaises(exception.StackValidationFailed, rsrc.validate)
|
||||||
|
|
||||||
def test_create_with_protocol_any(self):
|
def test_create_with_protocol_any(self):
|
||||||
@ -414,9 +420,9 @@ class FirewallRuleTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
|
|
||||||
snippet = template_format.parse(firewall_rule_template)
|
snippet = template_format.parse(firewall_rule_template)
|
||||||
|
snippet['resources']['firewall_rule']['properties']['protocol'] = 'any'
|
||||||
stack = utils.parse_stack(snippet)
|
stack = utils.parse_stack(snippet)
|
||||||
rsrc = stack['firewall_rule']
|
rsrc = stack['firewall_rule']
|
||||||
rsrc.t['Properties']['protocol'] = 'any'
|
|
||||||
|
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state)
|
self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state)
|
||||||
@ -514,8 +520,9 @@ class FirewallRuleTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = self.tmpl['resources']['firewall_rule']['properties'].copy()
|
||||||
update_template['Properties']['protocol'] = 'icmp'
|
props['protocol'] = 'icmp'
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||||
|
|
||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
@ -527,7 +534,8 @@ class FirewallRuleTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
# update to 'any' protocol
|
# update to 'any' protocol
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = self.tmpl['resources']['firewall_rule']['properties'].copy()
|
||||||
update_template['Properties']['protocol'] = 'any'
|
props['protocol'] = 'any'
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
|
@ -190,6 +190,7 @@ class HealthMonitorTest(common.HeatTestCase):
|
|||||||
|
|
||||||
snippet = template_format.parse(health_monitor_template)
|
snippet = template_format.parse(health_monitor_template)
|
||||||
self.stack = utils.parse_stack(snippet)
|
self.stack = utils.parse_stack(snippet)
|
||||||
|
self.tmpl = snippet
|
||||||
resource_defns = self.stack.t.resource_definitions(self.stack)
|
resource_defns = self.stack.t.resource_definitions(self.stack)
|
||||||
return loadbalancer.HealthMonitor(
|
return loadbalancer.HealthMonitor(
|
||||||
'monitor', resource_defns['monitor'], self.stack)
|
'monitor', resource_defns['monitor'], self.stack)
|
||||||
@ -291,8 +292,9 @@ class HealthMonitorTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = self.tmpl['resources']['monitor']['properties'].copy()
|
||||||
update_template['Properties']['delay'] = 10
|
props['delay'] = 10
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||||
|
|
||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
@ -326,6 +328,7 @@ class PoolTest(common.HeatTestCase):
|
|||||||
else:
|
else:
|
||||||
snippet = template_format.parse(pool_template_deprecated)
|
snippet = template_format.parse(pool_template_deprecated)
|
||||||
self.stack = utils.parse_stack(snippet)
|
self.stack = utils.parse_stack(snippet)
|
||||||
|
self.tmpl = snippet
|
||||||
neutronclient.Client.create_pool({
|
neutronclient.Client.create_pool({
|
||||||
'pool': {
|
'pool': {
|
||||||
'subnet_id': 'sub123', 'protocol': u'HTTP',
|
'subnet_id': 'sub123', 'protocol': u'HTTP',
|
||||||
@ -799,8 +802,9 @@ class PoolTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = self.tmpl['resources']['pool']['properties'].copy()
|
||||||
update_template['Properties']['admin_state_up'] = False
|
props['admin_state_up'] = False
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||||
|
|
||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
@ -847,8 +851,9 @@ class PoolTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = snippet['resources']['pool']['properties'].copy()
|
||||||
update_template['Properties']['monitors'] = ['mon123', 'mon789']
|
props['monitors'] = ['mon123', 'mon789']
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||||
|
|
||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
@ -874,6 +879,7 @@ class PoolMemberTest(common.HeatTestCase):
|
|||||||
).AndReturn({'member': {'id': 'member5678'}})
|
).AndReturn({'member': {'id': 'member5678'}})
|
||||||
snippet = template_format.parse(member_template)
|
snippet = template_format.parse(member_template)
|
||||||
self.stack = utils.parse_stack(snippet)
|
self.stack = utils.parse_stack(snippet)
|
||||||
|
self.tmpl = snippet
|
||||||
resource_defns = self.stack.t.resource_definitions(self.stack)
|
resource_defns = self.stack.t.resource_definitions(self.stack)
|
||||||
return loadbalancer.PoolMember(
|
return loadbalancer.PoolMember(
|
||||||
'member', resource_defns['member'], self.stack)
|
'member', resource_defns['member'], self.stack)
|
||||||
@ -927,8 +933,9 @@ class PoolMemberTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = self.tmpl['resources']['member']['properties'].copy()
|
||||||
update_template['Properties']['pool_id'] = 'pool456'
|
props['pool_id'] = 'pool456'
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
@ -1001,8 +1008,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = dict(rsrc.properties)
|
||||||
update_template['Properties']['members'] = ['5678']
|
props['members'] = ['5678']
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
@ -1015,8 +1023,9 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = dict(rsrc.properties)
|
||||||
update_template['Properties']['members'] = []
|
props['members'] = []
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
|
|
||||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||||
self.assertEqual((rsrc.UPDATE, rsrc.COMPLETE), rsrc.state)
|
self.assertEqual((rsrc.UPDATE, rsrc.COMPLETE), rsrc.state)
|
||||||
|
@ -224,7 +224,10 @@ class NeutronRouterTest(common.HeatTestCase):
|
|||||||
props['distributed'] = True
|
props['distributed'] = True
|
||||||
stack = utils.parse_stack(t)
|
stack = utils.parse_stack(t)
|
||||||
rsrc = stack['router']
|
rsrc = stack['router']
|
||||||
rsrc.t['Properties'].pop('l3_agent_ids')
|
update_props = props.copy()
|
||||||
|
del update_props['l3_agent_ids']
|
||||||
|
rsrc.t = rsrc.t.freeze(properties=update_props)
|
||||||
|
rsrc.reparse()
|
||||||
exc = self.assertRaises(exception.ResourcePropertyConflict,
|
exc = self.assertRaises(exception.ResourcePropertyConflict,
|
||||||
rsrc.validate)
|
rsrc.validate)
|
||||||
self.assertIn('distributed, ha', six.text_type(exc))
|
self.assertIn('distributed, ha', six.text_type(exc))
|
||||||
@ -942,11 +945,12 @@ class NeutronRouterTest(common.HeatTestCase):
|
|||||||
stack = utils.parse_stack(t)
|
stack = utils.parse_stack(t)
|
||||||
rsrc = self.create_router(t, stack, 'router')
|
rsrc = self.create_router(t, stack, 'router')
|
||||||
|
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = t['resources']['router']['properties'].copy()
|
||||||
update_template['Properties']['external_gateway_info'] = {
|
props['external_gateway_info'] = {
|
||||||
"network": "other_public",
|
"network": "other_public",
|
||||||
"enable_snat": False
|
"enable_snat": False
|
||||||
}
|
}
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||||
self.assertEqual((rsrc.UPDATE, rsrc.COMPLETE), rsrc.state)
|
self.assertEqual((rsrc.UPDATE, rsrc.COMPLETE), rsrc.state)
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ class NeutronSubnetPoolTest(common.HeatTestCase):
|
|||||||
ref_id = rsrc.FnGetRefId()
|
ref_id = rsrc.FnGetRefId()
|
||||||
self.assertEqual('fc68ea2c-b60b-4b4f-bd82-94ec81110766', ref_id)
|
self.assertEqual('fc68ea2c-b60b-4b4f-bd82-94ec81110766', ref_id)
|
||||||
update_snippet = rsrc_defn.ResourceDefinition(rsrc.name, rsrc.type(),
|
update_snippet = rsrc_defn.ResourceDefinition(rsrc.name, rsrc.type(),
|
||||||
rsrc.t)
|
rsrc.t._properties)
|
||||||
self.assertIsNone(rsrc.handle_update(update_snippet, {}, {}))
|
self.assertIsNone(rsrc.handle_update(update_snippet, {}, {}))
|
||||||
update_subnetpool.assert_not_called()
|
update_subnetpool.assert_not_called()
|
||||||
|
|
||||||
|
@ -454,8 +454,9 @@ class IPsecSiteConnectionTest(common.HeatTestCase):
|
|||||||
'con123', {'ipsec_site_connection': {'admin_state_up': False}})
|
'con123', {'ipsec_site_connection': {'admin_state_up': False}})
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = dict(rsrc.properties)
|
||||||
update_template['Properties']['admin_state_up'] = False
|
props['admin_state_up'] = False
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
|
|
||||||
@ -598,8 +599,9 @@ class IKEPolicyTest(common.HeatTestCase):
|
|||||||
'name': 'New IKEPolicy'}})
|
'name': 'New IKEPolicy'}})
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
props = dict(rsrc.properties)
|
||||||
update_template['Properties']['name'] = 'New IKEPolicy'
|
props['name'] = 'New IKEPolicy'
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
|
|
||||||
@ -743,6 +745,8 @@ class IPsecPolicyTest(common.HeatTestCase):
|
|||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
update_template = copy.deepcopy(rsrc.t)
|
update_template = copy.deepcopy(rsrc.t)
|
||||||
update_template['Properties']['name'] = 'New IPsecPolicy'
|
props = dict(rsrc.properties)
|
||||||
|
props['name'] = 'New IPsecPolicy'
|
||||||
|
update_template = rsrc.t.freeze(properties=props)
|
||||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
|
@ -252,6 +252,7 @@ class ServersTest(common.HeatTestCase):
|
|||||||
server_name = str(name) if override_name else None
|
server_name = str(name) if override_name else None
|
||||||
tmpl, self.stack = self._get_test_template(stack_name, server_name,
|
tmpl, self.stack = self._get_test_template(stack_name, server_name,
|
||||||
image_id)
|
image_id)
|
||||||
|
self.server_props = tmpl.t['Resources']['WebServer']['Properties']
|
||||||
resource_defns = tmpl.resource_definitions(self.stack)
|
resource_defns = tmpl.resource_definitions(self.stack)
|
||||||
server = servers.Server(str(name), resource_defns['WebServer'],
|
server = servers.Server(str(name), resource_defns['WebServer'],
|
||||||
self.stack)
|
self.stack)
|
||||||
@ -563,8 +564,8 @@ class ServersTest(common.HeatTestCase):
|
|||||||
return_server = self.fc.servers.list()[1]
|
return_server = self.fc.servers.list()[1]
|
||||||
(tmpl, stack) = self._setup_test_stack(stack_name)
|
(tmpl, stack) = self._setup_test_stack(stack_name)
|
||||||
self.stack = stack
|
self.stack = stack
|
||||||
tmpl['Resources']['WebServer']['Properties'][
|
self.server_props = tmpl['Resources']['WebServer']['Properties']
|
||||||
'user_data_format'] = 'SOFTWARE_CONFIG'
|
self.server_props['user_data_format'] = 'SOFTWARE_CONFIG'
|
||||||
if md is not None:
|
if md is not None:
|
||||||
tmpl['Resources']['WebServer']['Metadata'] = md
|
tmpl['Resources']['WebServer']['Metadata'] = md
|
||||||
|
|
||||||
@ -644,6 +645,7 @@ class ServersTest(common.HeatTestCase):
|
|||||||
props['software_config_transport'] = 'POLL_SERVER_HEAT'
|
props['software_config_transport'] = 'POLL_SERVER_HEAT'
|
||||||
if md is not None:
|
if md is not None:
|
||||||
tmpl.t['Resources']['WebServer']['Metadata'] = md
|
tmpl.t['Resources']['WebServer']['Metadata'] = md
|
||||||
|
self.server_props = props
|
||||||
|
|
||||||
resource_defns = tmpl.resource_definitions(stack)
|
resource_defns = tmpl.resource_definitions(stack)
|
||||||
server = servers.Server('WebServer',
|
server = servers.Server('WebServer',
|
||||||
@ -710,6 +712,7 @@ class ServersTest(common.HeatTestCase):
|
|||||||
props['software_config_transport'] = 'POLL_TEMP_URL'
|
props['software_config_transport'] = 'POLL_TEMP_URL'
|
||||||
if md is not None:
|
if md is not None:
|
||||||
tmpl.t['Resources']['WebServer']['Metadata'] = md
|
tmpl.t['Resources']['WebServer']['Metadata'] = md
|
||||||
|
self.server_props = props
|
||||||
|
|
||||||
resource_defns = tmpl.resource_definitions(stack)
|
resource_defns = tmpl.resource_definitions(stack)
|
||||||
server = servers.Server('WebServer',
|
server = servers.Server('WebServer',
|
||||||
@ -790,6 +793,7 @@ class ServersTest(common.HeatTestCase):
|
|||||||
props['software_config_transport'] = 'ZAQAR_MESSAGE'
|
props['software_config_transport'] = 'ZAQAR_MESSAGE'
|
||||||
if md is not None:
|
if md is not None:
|
||||||
tmpl.t['Resources']['WebServer']['Metadata'] = md
|
tmpl.t['Resources']['WebServer']['Metadata'] = md
|
||||||
|
self.server_props = props
|
||||||
|
|
||||||
resource_defns = tmpl.resource_definitions(stack)
|
resource_defns = tmpl.resource_definitions(stack)
|
||||||
server = servers.Server('WebServer',
|
server = servers.Server('WebServer',
|
||||||
@ -1448,9 +1452,9 @@ class ServersTest(common.HeatTestCase):
|
|||||||
sc.url = 'http://192.0.2.2'
|
sc.url = 'http://192.0.2.2'
|
||||||
self.patchobject(swift.SwiftClientPlugin, '_create',
|
self.patchobject(swift.SwiftClientPlugin, '_create',
|
||||||
return_value=sc)
|
return_value=sc)
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = self.server_props.copy()
|
||||||
update_template['Properties'][
|
update_props['software_config_transport'] = 'POLL_TEMP_URL'
|
||||||
'software_config_transport'] = 'POLL_TEMP_URL'
|
update_template = server.t.freeze(properties=update_props)
|
||||||
|
|
||||||
self.rpc_client = mock.MagicMock()
|
self.rpc_client = mock.MagicMock()
|
||||||
server._rpc_client = self.rpc_client
|
server._rpc_client = self.rpc_client
|
||||||
@ -1491,8 +1495,9 @@ class ServersTest(common.HeatTestCase):
|
|||||||
self.patchobject(self.fc.servers, 'get',
|
self.patchobject(self.fc.servers, 'get',
|
||||||
return_value=return_server)
|
return_value=return_server)
|
||||||
set_meta_mock = self.patchobject(self.fc.servers, 'set_meta')
|
set_meta_mock = self.patchobject(self.fc.servers, 'set_meta')
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = self.server_props.copy()
|
||||||
update_template['Properties']['metadata'] = new_meta
|
update_props['metadata'] = new_meta
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
scheduler.TaskRunner(server.update, update_template)()
|
scheduler.TaskRunner(server.update, update_template)()
|
||||||
self.assertEqual((server.UPDATE, server.COMPLETE), server.state)
|
self.assertEqual((server.UPDATE, server.COMPLETE), server.state)
|
||||||
set_meta_mock.assert_called_with(
|
set_meta_mock.assert_called_with(
|
||||||
@ -1514,8 +1519,9 @@ class ServersTest(common.HeatTestCase):
|
|||||||
|
|
||||||
# If we're going to call set_meta() directly we
|
# If we're going to call set_meta() directly we
|
||||||
# need to handle the serialization ourselves.
|
# need to handle the serialization ourselves.
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = self.server_props.copy()
|
||||||
update_template['Properties']['metadata'] = new_meta
|
update_props['metadata'] = new_meta
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
scheduler.TaskRunner(server.update, update_template)()
|
scheduler.TaskRunner(server.update, update_template)()
|
||||||
self.assertEqual((server.UPDATE, server.COMPLETE), server.state)
|
self.assertEqual((server.UPDATE, server.COMPLETE), server.state)
|
||||||
set_meta_mock.assert_called_with(
|
set_meta_mock.assert_called_with(
|
||||||
@ -1531,8 +1537,9 @@ class ServersTest(common.HeatTestCase):
|
|||||||
self.patchobject(self.fc.servers, 'get',
|
self.patchobject(self.fc.servers, 'get',
|
||||||
return_value=return_server)
|
return_value=return_server)
|
||||||
set_meta_mock = self.patchobject(self.fc.servers, 'set_meta')
|
set_meta_mock = self.patchobject(self.fc.servers, 'set_meta')
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = self.server_props.copy()
|
||||||
update_template['Properties']['metadata'] = new_meta
|
update_props['metadata'] = new_meta
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
scheduler.TaskRunner(server.update, update_template)()
|
scheduler.TaskRunner(server.update, update_template)()
|
||||||
self.assertEqual((server.UPDATE, server.COMPLETE), server.state)
|
self.assertEqual((server.UPDATE, server.COMPLETE), server.state)
|
||||||
set_meta_mock.assert_called_with(
|
set_meta_mock.assert_called_with(
|
||||||
@ -1547,8 +1554,9 @@ class ServersTest(common.HeatTestCase):
|
|||||||
self.patchobject(self.fc.servers, 'get',
|
self.patchobject(self.fc.servers, 'get',
|
||||||
return_value=new_return_server)
|
return_value=new_return_server)
|
||||||
del_meta_mock = self.patchobject(self.fc.servers, 'delete_meta')
|
del_meta_mock = self.patchobject(self.fc.servers, 'delete_meta')
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = self.server_props.copy()
|
||||||
update_template['Properties']['metadata'] = new_meta
|
update_props['metadata'] = new_meta
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
|
|
||||||
scheduler.TaskRunner(server.update, update_template)()
|
scheduler.TaskRunner(server.update, update_template)()
|
||||||
self.assertEqual((server.UPDATE, server.COMPLETE), server.state)
|
self.assertEqual((server.UPDATE, server.COMPLETE), server.state)
|
||||||
@ -1564,8 +1572,9 @@ class ServersTest(common.HeatTestCase):
|
|||||||
server = self._create_test_server(return_server,
|
server = self._create_test_server(return_server,
|
||||||
'srv_update')
|
'srv_update')
|
||||||
new_name = 'new_name'
|
new_name = 'new_name'
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = self.server_props.copy()
|
||||||
update_template['Properties']['name'] = new_name
|
update_props['name'] = new_name
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
|
|
||||||
self.patchobject(self.fc.servers, 'get',
|
self.patchobject(self.fc.servers, 'get',
|
||||||
return_value=return_server)
|
return_value=return_server)
|
||||||
@ -1581,8 +1590,9 @@ class ServersTest(common.HeatTestCase):
|
|||||||
server = self._create_test_server(return_server,
|
server = self._create_test_server(return_server,
|
||||||
'change_password')
|
'change_password')
|
||||||
new_password = 'new_password'
|
new_password = 'new_password'
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = self.server_props.copy()
|
||||||
update_template['Properties']['admin_pass'] = new_password
|
update_props['admin_pass'] = new_password
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
|
|
||||||
self.patchobject(self.fc.servers, 'get', return_value=return_server)
|
self.patchobject(self.fc.servers, 'get', return_value=return_server)
|
||||||
self.patchobject(return_server, 'change_password')
|
self.patchobject(return_server, 'change_password')
|
||||||
@ -1602,8 +1612,9 @@ class ServersTest(common.HeatTestCase):
|
|||||||
return_server.id = '1234'
|
return_server.id = '1234'
|
||||||
server = self._create_test_server(return_server,
|
server = self._create_test_server(return_server,
|
||||||
'srv_update')
|
'srv_update')
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = self.server_props.copy()
|
||||||
update_template['Properties']['flavor'] = 'm1.small'
|
update_props['flavor'] = 'm1.small'
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
|
|
||||||
def set_status(status):
|
def set_status(status):
|
||||||
return_server.status = status
|
return_server.status = status
|
||||||
@ -1633,8 +1644,9 @@ class ServersTest(common.HeatTestCase):
|
|||||||
return_server.id = '1234'
|
return_server.id = '1234'
|
||||||
server = self._create_test_server(return_server,
|
server = self._create_test_server(return_server,
|
||||||
'srv_update2')
|
'srv_update2')
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = self.server_props.copy()
|
||||||
update_template['Properties']['flavor'] = 'm1.small'
|
update_props['flavor'] = 'm1.small'
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
|
|
||||||
def set_status(status):
|
def set_status(status):
|
||||||
return_server.status = status
|
return_server.status = status
|
||||||
@ -1668,8 +1680,9 @@ class ServersTest(common.HeatTestCase):
|
|||||||
server_resource = self._create_test_server(server,
|
server_resource = self._create_test_server(server,
|
||||||
'resize_server')
|
'resize_server')
|
||||||
# prepare template with resized server
|
# prepare template with resized server
|
||||||
update_template = copy.deepcopy(server_resource.t)
|
update_props = self.server_props.copy()
|
||||||
update_template['Properties']['flavor'] = 'm1.small'
|
update_props['flavor'] = 'm1.small'
|
||||||
|
update_template = server_resource.t.freeze(properties=update_props)
|
||||||
|
|
||||||
# define status transition when server resize
|
# define status transition when server resize
|
||||||
# ACTIVE(initial) -> ACTIVE -> RESIZE -> VERIFY_RESIZE
|
# ACTIVE(initial) -> ACTIVE -> RESIZE -> VERIFY_RESIZE
|
||||||
@ -1700,13 +1713,14 @@ class ServersTest(common.HeatTestCase):
|
|||||||
def test_server_update_server_flavor_replace(self, mock_replace):
|
def test_server_update_server_flavor_replace(self, mock_replace):
|
||||||
stack_name = 'update_flvrep'
|
stack_name = 'update_flvrep'
|
||||||
(tmpl, stack) = self._setup_test_stack(stack_name)
|
(tmpl, stack) = self._setup_test_stack(stack_name)
|
||||||
tmpl['Resources']['WebServer']['Properties'][
|
server_props = tmpl['Resources']['WebServer']['Properties']
|
||||||
'flavor_update_policy'] = 'REPLACE'
|
server_props['flavor_update_policy'] = 'REPLACE'
|
||||||
resource_defns = tmpl.resource_definitions(stack)
|
resource_defns = tmpl.resource_definitions(stack)
|
||||||
server = servers.Server('server_server_update_flavor_replace',
|
server = servers.Server('server_server_update_flavor_replace',
|
||||||
resource_defns['WebServer'], stack)
|
resource_defns['WebServer'], stack)
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = server_props.copy()
|
||||||
update_template['Properties']['flavor'] = 'm1.small'
|
update_props['flavor'] = 'm1.small'
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
updater = scheduler.TaskRunner(server.update, update_template)
|
updater = scheduler.TaskRunner(server.update, update_template)
|
||||||
self.assertRaises(exception.UpdateReplace, updater)
|
self.assertRaises(exception.UpdateReplace, updater)
|
||||||
|
|
||||||
@ -1718,12 +1732,13 @@ class ServersTest(common.HeatTestCase):
|
|||||||
server = servers.Server('server_server_update_flavor_replace',
|
server = servers.Server('server_server_update_flavor_replace',
|
||||||
resource_defns['WebServer'], stack)
|
resource_defns['WebServer'], stack)
|
||||||
|
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = tmpl.t['Resources']['WebServer']['Properties'].copy()
|
||||||
# confirm that when flavor_update_policy is changed during
|
# confirm that when flavor_update_policy is changed during
|
||||||
# the update then the updated policy is followed for a flavor
|
# the update then the updated policy is followed for a flavor
|
||||||
# update
|
# update
|
||||||
update_template['Properties']['flavor_update_policy'] = 'REPLACE'
|
update_props['flavor_update_policy'] = 'REPLACE'
|
||||||
update_template['Properties']['flavor'] = 'm1.small'
|
update_props['flavor'] = 'm1.small'
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
updater = scheduler.TaskRunner(server.update, update_template)
|
updater = scheduler.TaskRunner(server.update, update_template)
|
||||||
self.assertRaises(exception.UpdateReplace, updater)
|
self.assertRaises(exception.UpdateReplace, updater)
|
||||||
|
|
||||||
@ -1737,8 +1752,9 @@ class ServersTest(common.HeatTestCase):
|
|||||||
server = servers.Server('server_update_userdata_replace',
|
server = servers.Server('server_update_userdata_replace',
|
||||||
resource_defns['WebServer'], stack)
|
resource_defns['WebServer'], stack)
|
||||||
|
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = tmpl.t['Resources']['WebServer']['Properties'].copy()
|
||||||
update_template['Properties']['user_data'] = 'changed'
|
update_props['user_data'] = 'changed'
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
server.action = server.CREATE
|
server.action = server.CREATE
|
||||||
updater = scheduler.TaskRunner(server.update, update_template)
|
updater = scheduler.TaskRunner(server.update, update_template)
|
||||||
self.assertRaises(exception.UpdateReplace, updater)
|
self.assertRaises(exception.UpdateReplace, updater)
|
||||||
@ -1756,9 +1772,10 @@ class ServersTest(common.HeatTestCase):
|
|||||||
server = servers.Server('server_update_userdata_ignore',
|
server = servers.Server('server_update_userdata_ignore',
|
||||||
resource_defns['WebServer'], stack)
|
resource_defns['WebServer'], stack)
|
||||||
|
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = tmpl.t['Resources']['WebServer']['Properties'].copy()
|
||||||
update_template['Properties']['user_data'] = 'changed'
|
update_props['user_data'] = 'changed'
|
||||||
update_template['Properties']['user_data_update_policy'] = 'IGNORE'
|
update_props['user_data_update_policy'] = 'IGNORE'
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
server.action = server.CREATE
|
server.action = server.CREATE
|
||||||
scheduler.TaskRunner(server.update, update_template)()
|
scheduler.TaskRunner(server.update, update_template)()
|
||||||
self.assertEqual((server.UPDATE, server.COMPLETE), server.state)
|
self.assertEqual((server.UPDATE, server.COMPLETE), server.state)
|
||||||
@ -1774,8 +1791,9 @@ class ServersTest(common.HeatTestCase):
|
|||||||
server = servers.Server('server_update_image_replace',
|
server = servers.Server('server_update_image_replace',
|
||||||
resource_defns['WebServer'], stack)
|
resource_defns['WebServer'], stack)
|
||||||
image_id = self.getUniqueString()
|
image_id = self.getUniqueString()
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = tmpl.t['Resources']['WebServer']['Properties'].copy()
|
||||||
update_template['Properties']['image'] = image_id
|
update_props['image'] = image_id
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
updater = scheduler.TaskRunner(server.update, update_template)
|
updater = scheduler.TaskRunner(server.update, update_template)
|
||||||
self.assertRaises(exception.UpdateReplace, updater)
|
self.assertRaises(exception.UpdateReplace, updater)
|
||||||
|
|
||||||
@ -1791,12 +1809,16 @@ class ServersTest(common.HeatTestCase):
|
|||||||
new_image = 'F17-x86_64-gold'
|
new_image = 'F17-x86_64-gold'
|
||||||
# current test demonstrate updating when image_update_policy was not
|
# current test demonstrate updating when image_update_policy was not
|
||||||
# changed, so image_update_policy will be used from self.properties
|
# changed, so image_update_policy will be used from self.properties
|
||||||
server.t['Properties']['image_update_policy'] = policy
|
before_props = self.server_props.copy()
|
||||||
|
before_props['image_update_policy'] = policy
|
||||||
|
server.t = server.t.freeze(properties=before_props)
|
||||||
|
server.reparse()
|
||||||
|
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = before_props.copy()
|
||||||
update_template['Properties']['image'] = new_image
|
update_props['image'] = new_image
|
||||||
if password:
|
if password:
|
||||||
update_template['Properties']['admin_pass'] = password
|
update_props['admin_pass'] = password
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
|
|
||||||
mock_rebuild = self.patchobject(self.fc.servers, 'rebuild')
|
mock_rebuild = self.patchobject(self.fc.servers, 'rebuild')
|
||||||
|
|
||||||
@ -1857,9 +1879,13 @@ class ServersTest(common.HeatTestCase):
|
|||||||
new_image = 'F17-x86_64-gold'
|
new_image = 'F17-x86_64-gold'
|
||||||
# current test demonstrate updating when image_update_policy was not
|
# current test demonstrate updating when image_update_policy was not
|
||||||
# changed, so image_update_policy will be used from self.properties
|
# changed, so image_update_policy will be used from self.properties
|
||||||
server.t['Properties']['image_update_policy'] = 'REBUILD'
|
before_props = self.server_props.copy()
|
||||||
update_template = copy.deepcopy(server.t)
|
before_props['image_update_policy'] = 'REBUILD'
|
||||||
update_template['Properties']['image'] = new_image
|
update_props = before_props.copy()
|
||||||
|
update_props['image'] = new_image
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
|
server.t = server.t.freeze(properties=before_props)
|
||||||
|
server.reparse()
|
||||||
mock_rebuild = self.patchobject(self.fc.servers, 'rebuild')
|
mock_rebuild = self.patchobject(self.fc.servers, 'rebuild')
|
||||||
|
|
||||||
def set_status(status):
|
def set_status(status):
|
||||||
@ -1883,9 +1909,10 @@ class ServersTest(common.HeatTestCase):
|
|||||||
return_server = self.fc.servers.list()[1]
|
return_server = self.fc.servers.list()[1]
|
||||||
server = self._create_test_server(return_server,
|
server = self._create_test_server(return_server,
|
||||||
'update_prop')
|
'update_prop')
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = self.server_props.copy()
|
||||||
update_template['Properties']['image'] = 'F17-x86_64-gold'
|
update_props['image'] = 'F17-x86_64-gold'
|
||||||
update_template['Properties']['image_update_policy'] = 'REPLACE'
|
update_props['image_update_policy'] = 'REPLACE'
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
updater = scheduler.TaskRunner(server.update, update_template)
|
updater = scheduler.TaskRunner(server.update, update_template)
|
||||||
self.assertRaises(exception.UpdateReplace, updater)
|
self.assertRaises(exception.UpdateReplace, updater)
|
||||||
|
|
||||||
@ -2964,12 +2991,11 @@ class ServersTest(common.HeatTestCase):
|
|||||||
server = self._create_test_server(return_server, 'networks_update')
|
server = self._create_test_server(return_server, 'networks_update')
|
||||||
|
|
||||||
new_networks = [{'port': '2a60cbaa-3d33-4af6-a9ce-83594ac546fc'}]
|
new_networks = [{'port': '2a60cbaa-3d33-4af6-a9ce-83594ac546fc'}]
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = self.server_props.copy()
|
||||||
update_template['Properties']['networks'] = new_networks
|
update_props['networks'] = new_networks
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
|
|
||||||
self.patchobject(self.fc.servers, 'get', return_value=return_server)
|
self.patchobject(self.fc.servers, 'get', return_value=return_server)
|
||||||
# to make sure, that old_networks will be None
|
|
||||||
self.assertFalse(hasattr(server.t['Properties'], 'networks'))
|
|
||||||
|
|
||||||
iface = self.create_fake_iface('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
|
iface = self.create_fake_iface('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
|
||||||
'450abbc9-9b6d-4d6f-8c3a-c47ac34100ef',
|
'450abbc9-9b6d-4d6f-8c3a-c47ac34100ef',
|
||||||
@ -2994,14 +3020,12 @@ class ServersTest(common.HeatTestCase):
|
|||||||
|
|
||||||
new_networks = [{'network': 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
|
new_networks = [{'network': 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
|
||||||
'fixed_ip': '1.2.3.4'}]
|
'fixed_ip': '1.2.3.4'}]
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = self.server_props.copy()
|
||||||
update_template['Properties']['networks'] = new_networks
|
update_props['networks'] = new_networks
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
|
|
||||||
self.patchobject(self.fc.servers, 'get', return_value=return_server)
|
self.patchobject(self.fc.servers, 'get', return_value=return_server)
|
||||||
|
|
||||||
# to make sure, that old_networks will be None
|
|
||||||
self.assertFalse(hasattr(server.t['Properties'], 'networks'))
|
|
||||||
|
|
||||||
iface = self.create_fake_iface('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
|
iface = self.create_fake_iface('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
|
||||||
'450abbc9-9b6d-4d6f-8c3a-c47ac34100ef',
|
'450abbc9-9b6d-4d6f-8c3a-c47ac34100ef',
|
||||||
'1.2.3.4')
|
'1.2.3.4')
|
||||||
@ -3022,14 +3046,12 @@ class ServersTest(common.HeatTestCase):
|
|||||||
new_networks = [{'network': 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
|
new_networks = [{'network': 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
|
||||||
'fixed_ip': '1.2.3.4',
|
'fixed_ip': '1.2.3.4',
|
||||||
'port': '2a60cbaa-3d33-4af6-a9ce-83594ac546fc'}]
|
'port': '2a60cbaa-3d33-4af6-a9ce-83594ac546fc'}]
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = self.server_props.copy()
|
||||||
update_template['Properties']['networks'] = new_networks
|
update_props['networks'] = new_networks
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
|
|
||||||
self.patchobject(self.fc.servers, 'get', return_value=return_server)
|
self.patchobject(self.fc.servers, 'get', return_value=return_server)
|
||||||
|
|
||||||
# to make sure, that old_networks will be None
|
|
||||||
self.assertFalse(hasattr(server.t['Properties'], 'networks'))
|
|
||||||
|
|
||||||
iface = self.create_fake_iface('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
|
iface = self.create_fake_iface('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
|
||||||
'450abbc9-9b6d-4d6f-8c3a-c47ac34100ef',
|
'450abbc9-9b6d-4d6f-8c3a-c47ac34100ef',
|
||||||
'1.2.3.4')
|
'1.2.3.4')
|
||||||
@ -3059,9 +3081,13 @@ class ServersTest(common.HeatTestCase):
|
|||||||
'fixed_ip': '1.2.3.4'},
|
'fixed_ip': '1.2.3.4'},
|
||||||
{'port': '2a60cbaa-3d33-4af6-a9ce-83594ac546fc'}]
|
{'port': '2a60cbaa-3d33-4af6-a9ce-83594ac546fc'}]
|
||||||
|
|
||||||
server.t['Properties']['networks'] = old_networks
|
before_props = self.server_props.copy()
|
||||||
update_template = copy.deepcopy(server.t)
|
before_props['networks'] = old_networks
|
||||||
update_template['Properties']['networks'] = new_networks
|
update_props = self.server_props.copy()
|
||||||
|
update_props['networks'] = new_networks
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
|
server.t = server.t.freeze(properties=before_props)
|
||||||
|
# server.reparse()
|
||||||
|
|
||||||
self.patchobject(self.fc.servers, 'get', return_value=return_server)
|
self.patchobject(self.fc.servers, 'get', return_value=return_server)
|
||||||
|
|
||||||
@ -3100,9 +3126,13 @@ class ServersTest(common.HeatTestCase):
|
|||||||
{'network': 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
|
{'network': 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
|
||||||
'fixed_ip': '31.32.33.34'}]
|
'fixed_ip': '31.32.33.34'}]
|
||||||
|
|
||||||
server.t['Properties']['networks'] = old_networks
|
before_props = self.server_props.copy()
|
||||||
update_template = copy.deepcopy(server.t)
|
before_props['networks'] = old_networks
|
||||||
update_template['Properties']['networks'] = None
|
update_props = self.server_props.copy()
|
||||||
|
update_props['networks'] = None
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
|
server.t = server.t.freeze(properties=before_props)
|
||||||
|
# server.reparse()
|
||||||
|
|
||||||
self.patchobject(self.fc.servers, 'get', return_value=return_server)
|
self.patchobject(self.fc.servers, 'get', return_value=return_server)
|
||||||
poor_interfaces = [
|
poor_interfaces = [
|
||||||
@ -3137,9 +3167,13 @@ class ServersTest(common.HeatTestCase):
|
|||||||
{'network': 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
|
{'network': 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
|
||||||
'fixed_ip': '31.32.33.34'}]
|
'fixed_ip': '31.32.33.34'}]
|
||||||
|
|
||||||
server.t['Properties']['networks'] = old_networks
|
before_props = self.server_props.copy()
|
||||||
update_template = copy.deepcopy(server.t)
|
before_props['networks'] = old_networks
|
||||||
update_template['Properties']['networks'] = []
|
update_props = self.server_props.copy()
|
||||||
|
update_props['networks'] = []
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
|
server.t = server.t.freeze(properties=before_props)
|
||||||
|
# server.reparse()
|
||||||
|
|
||||||
self.patchobject(self.fc.servers, 'get', return_value=return_server)
|
self.patchobject(self.fc.servers, 'get', return_value=return_server)
|
||||||
poor_interfaces = [
|
poor_interfaces = [
|
||||||
@ -3172,9 +3206,10 @@ class ServersTest(common.HeatTestCase):
|
|||||||
server = self._create_test_server(return_server,
|
server = self._create_test_server(return_server,
|
||||||
'my_server')
|
'my_server')
|
||||||
|
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = self.server_props.copy()
|
||||||
update_template['Properties']['image'] = 'F17-x86_64-gold'
|
update_props['image'] = 'F17-x86_64-gold'
|
||||||
update_template['Properties']['image_update_policy'] = 'REPLACE'
|
update_props['image_update_policy'] = 'REPLACE'
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
updater = scheduler.TaskRunner(server.update, update_template)
|
updater = scheduler.TaskRunner(server.update, update_template)
|
||||||
self.assertRaises(exception.UpdateReplace, updater)
|
self.assertRaises(exception.UpdateReplace, updater)
|
||||||
|
|
||||||
@ -3190,8 +3225,9 @@ class ServersTest(common.HeatTestCase):
|
|||||||
self.patchobject(glance.GlanceClientPlugin,
|
self.patchobject(glance.GlanceClientPlugin,
|
||||||
'find_image_by_name_or_id',
|
'find_image_by_name_or_id',
|
||||||
side_effect=[1, ex])
|
side_effect=[1, ex])
|
||||||
update_template = copy.deepcopy(server.t)
|
update_props = self.server_props.copy()
|
||||||
update_template['Properties']['image'] = 'Update Image'
|
update_props['image'] = 'Update Image'
|
||||||
|
update_template = server.t.freeze(properties=update_props)
|
||||||
|
|
||||||
# update
|
# update
|
||||||
updater = scheduler.TaskRunner(server.update, update_template)
|
updater = scheduler.TaskRunner(server.update, update_template)
|
||||||
|
@ -75,8 +75,10 @@ class SaharaDataSourceTest(common.HeatTestCase):
|
|||||||
def test_update(self):
|
def test_update(self):
|
||||||
ds = self._create_resource('data-source', self.rsrc_defn,
|
ds = self._create_resource('data-source', self.rsrc_defn,
|
||||||
self.stack)
|
self.stack)
|
||||||
self.rsrc_defn['Properties']['type'] = 'hdfs'
|
props = self.stack.t.t['resources']['data-source']['properties'].copy()
|
||||||
self.rsrc_defn['Properties']['url'] = 'my/path'
|
props['type'] = 'hdfs'
|
||||||
|
props['url'] = 'my/path'
|
||||||
|
self.rsrc_defn = self.rsrc_defn.freeze(properties=props)
|
||||||
scheduler.TaskRunner(ds.update, self.rsrc_defn)()
|
scheduler.TaskRunner(ds.update, self.rsrc_defn)()
|
||||||
data = {
|
data = {
|
||||||
'name': 'my-ds',
|
'name': 'my-ds',
|
||||||
@ -100,7 +102,9 @@ class SaharaDataSourceTest(common.HeatTestCase):
|
|||||||
self.assertEqual({'ds': 'info'}, ds.FnGetAtt('show'))
|
self.assertEqual({'ds': 'info'}, ds.FnGetAtt('show'))
|
||||||
|
|
||||||
def test_validate_password_without_user(self):
|
def test_validate_password_without_user(self):
|
||||||
self.rsrc_defn['Properties']['credentials'].pop('user')
|
props = self.stack.t.t['resources']['data-source']['properties'].copy()
|
||||||
|
del props['credentials']['user']
|
||||||
|
self.rsrc_defn = self.rsrc_defn.freeze(properties=props)
|
||||||
ds = data_source.DataSource('data-source', self.rsrc_defn, self.stack)
|
ds = data_source.DataSource('data-source', self.rsrc_defn, self.stack)
|
||||||
ex = self.assertRaises(exception.StackValidationFailed, ds.validate)
|
ex = self.assertRaises(exception.StackValidationFailed, ds.validate)
|
||||||
error_msg = ('Property error: resources.data-source.properties.'
|
error_msg = ('Property error: resources.data-source.properties.'
|
||||||
|
@ -40,8 +40,8 @@ resources:
|
|||||||
class SaharaImageTest(common.HeatTestCase):
|
class SaharaImageTest(common.HeatTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(SaharaImageTest, self).setUp()
|
super(SaharaImageTest, self).setUp()
|
||||||
t = template_format.parse(sahara_image_template)
|
self.tmpl = template_format.parse(sahara_image_template)
|
||||||
self.stack = utils.parse_stack(t)
|
self.stack = utils.parse_stack(self.tmpl)
|
||||||
resource_defns = self.stack.t.resource_definitions(self.stack)
|
resource_defns = self.stack.t.resource_definitions(self.stack)
|
||||||
self.rsrc_defn = resource_defns['sahara-image']
|
self.rsrc_defn = resource_defns['sahara-image']
|
||||||
self.client = mock.Mock()
|
self.client = mock.Mock()
|
||||||
@ -68,8 +68,10 @@ class SaharaImageTest(common.HeatTestCase):
|
|||||||
|
|
||||||
def test_update(self):
|
def test_update(self):
|
||||||
img = self._create_resource('sahara-image', self.rsrc_defn, self.stack)
|
img = self._create_resource('sahara-image', self.rsrc_defn, self.stack)
|
||||||
self.rsrc_defn['Properties']['tags'] = []
|
props = self.tmpl['resources']['sahara-image']['properties'].copy()
|
||||||
self.rsrc_defn['Properties']['description'] = 'test image'
|
props['tags'] = []
|
||||||
|
props['description'] = 'test image'
|
||||||
|
self.rsrc_defn = self.rsrc_defn.freeze(properties=props)
|
||||||
scheduler.TaskRunner(img.update, self.rsrc_defn)()
|
scheduler.TaskRunner(img.update, self.rsrc_defn)()
|
||||||
tags_update_calls = [
|
tags_update_calls = [
|
||||||
mock.call('12345', ['vanilla', '1.2.1']),
|
mock.call('12345', ['vanilla', '1.2.1']),
|
||||||
|
@ -74,8 +74,9 @@ class SaharaJobBinaryTest(common.HeatTestCase):
|
|||||||
def test_update(self):
|
def test_update(self):
|
||||||
jb = self._create_resource('job-binary', self.rsrc_defn,
|
jb = self._create_resource('job-binary', self.rsrc_defn,
|
||||||
self.stack)
|
self.stack)
|
||||||
self.rsrc_defn['Properties']['url'] = (
|
props = self.stack.t.t['resources']['job-binary']['properties'].copy()
|
||||||
'internal-db://94b8821d-1ce7-4131-8364-a6c6d85ad57b')
|
props['url'] = 'internal-db://94b8821d-1ce7-4131-8364-a6c6d85ad57b'
|
||||||
|
self.rsrc_defn = self.rsrc_defn.freeze(properties=props)
|
||||||
scheduler.TaskRunner(jb.update, self.rsrc_defn)()
|
scheduler.TaskRunner(jb.update, self.rsrc_defn)()
|
||||||
data = {
|
data = {
|
||||||
'name': 'my-jb',
|
'name': 'my-jb',
|
||||||
@ -114,7 +115,9 @@ class SaharaJobBinaryTest(common.HeatTestCase):
|
|||||||
self.assertEqual({'jb': 'info'}, jb.FnGetAtt('show'))
|
self.assertEqual({'jb': 'info'}, jb.FnGetAtt('show'))
|
||||||
|
|
||||||
def test_validate_invalid_url(self):
|
def test_validate_invalid_url(self):
|
||||||
self.rsrc_defn['Properties']['url'] = 'internal-db://38273f82'
|
props = self.stack.t.t['resources']['job-binary']['properties'].copy()
|
||||||
|
props['url'] = 'internal-db://38273f82'
|
||||||
|
self.rsrc_defn = self.rsrc_defn.freeze(properties=props)
|
||||||
jb = job_binary.JobBinary('job-binary', self.rsrc_defn, self.stack)
|
jb = job_binary.JobBinary('job-binary', self.rsrc_defn, self.stack)
|
||||||
ex = self.assertRaises(exception.StackValidationFailed, jb.validate)
|
ex = self.assertRaises(exception.StackValidationFailed, jb.validate)
|
||||||
error_msg = ('resources.job-binary.properties: internal-db://38273f82 '
|
error_msg = ('resources.job-binary.properties: internal-db://38273f82 '
|
||||||
@ -122,7 +125,9 @@ class SaharaJobBinaryTest(common.HeatTestCase):
|
|||||||
self.assertEqual(error_msg, six.text_type(ex))
|
self.assertEqual(error_msg, six.text_type(ex))
|
||||||
|
|
||||||
def test_validate_password_without_user(self):
|
def test_validate_password_without_user(self):
|
||||||
self.rsrc_defn['Properties']['credentials'].pop('user')
|
props = self.stack.t.t['resources']['job-binary']['properties'].copy()
|
||||||
|
props['credentials'].pop('user')
|
||||||
|
self.rsrc_defn = self.rsrc_defn.freeze(properties=props)
|
||||||
jb = job_binary.JobBinary('job-binary', self.rsrc_defn, self.stack)
|
jb = job_binary.JobBinary('job-binary', self.rsrc_defn, self.stack)
|
||||||
ex = self.assertRaises(exception.StackValidationFailed, jb.validate)
|
ex = self.assertRaises(exception.StackValidationFailed, jb.validate)
|
||||||
error_msg = ('Property error: resources.job-binary.properties.'
|
error_msg = ('Property error: resources.job-binary.properties.'
|
||||||
|
@ -127,6 +127,7 @@ class SaharaNodeGroupTemplateTest(common.HeatTestCase):
|
|||||||
self.fake_ngt = FakeNodeGroupTemplate()
|
self.fake_ngt = FakeNodeGroupTemplate()
|
||||||
|
|
||||||
self.t = template_format.parse(node_group_template)
|
self.t = template_format.parse(node_group_template)
|
||||||
|
self.ngt_props = self.t['resources']['node-group']['properties']
|
||||||
|
|
||||||
def _init_ngt(self, template):
|
def _init_ngt(self, template):
|
||||||
self.stack = utils.parse_stack(template)
|
self.stack = utils.parse_stack(template)
|
||||||
@ -249,10 +250,10 @@ class SaharaNodeGroupTemplateTest(common.HeatTestCase):
|
|||||||
|
|
||||||
def test_update(self):
|
def test_update(self):
|
||||||
ngt = self._create_ngt(self.t)
|
ngt = self._create_ngt(self.t)
|
||||||
rsrc_defn = self.stack.t.resource_definitions(self.stack)['node-group']
|
props = self.ngt_props.copy()
|
||||||
rsrc_defn['Properties']['node_processes'] = [
|
props['node_processes'] = ['tasktracker', 'datanode']
|
||||||
'tasktracker', 'datanode']
|
props['name'] = 'new-ng-template'
|
||||||
rsrc_defn['Properties']['name'] = 'new-ng-template'
|
rsrc_defn = ngt.t.freeze(properties=props)
|
||||||
scheduler.TaskRunner(ngt.update, rsrc_defn)()
|
scheduler.TaskRunner(ngt.update, rsrc_defn)()
|
||||||
args = {'node_processes': ['tasktracker', 'datanode'],
|
args = {'node_processes': ['tasktracker', 'datanode'],
|
||||||
'name': 'new-ng-template'}
|
'name': 'new-ng-template'}
|
||||||
@ -341,9 +342,11 @@ class SaharaClusterTemplateTest(common.HeatTestCase):
|
|||||||
ct = self._create_ct(self.t)
|
ct = self._create_ct(self.t)
|
||||||
rsrc_defn = self.stack.t.resource_definitions(self.stack)[
|
rsrc_defn = self.stack.t.resource_definitions(self.stack)[
|
||||||
'cluster-template']
|
'cluster-template']
|
||||||
rsrc_defn['Properties']['plugin_name'] = 'hdp'
|
props = self.t['resources']['cluster-template']['properties'].copy()
|
||||||
rsrc_defn['Properties']['hadoop_version'] = '1.3.2'
|
props['plugin_name'] = 'hdp'
|
||||||
rsrc_defn['Properties']['name'] = 'new-cluster-template'
|
props['hadoop_version'] = '1.3.2'
|
||||||
|
props['name'] = 'new-cluster-template'
|
||||||
|
rsrc_defn = rsrc_defn.freeze(properties=props)
|
||||||
scheduler.TaskRunner(ct.update, rsrc_defn)()
|
scheduler.TaskRunner(ct.update, rsrc_defn)()
|
||||||
args = {
|
args = {
|
||||||
'plugin_name': 'hdp',
|
'plugin_name': 'hdp',
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import copy
|
||||||
import mock
|
import mock
|
||||||
import six
|
import six
|
||||||
from troveclient.openstack.common.apiclient import exceptions as troveexc
|
from troveclient.openstack.common.apiclient import exceptions as troveexc
|
||||||
@ -76,8 +77,8 @@ class TroveClusterTest(common.HeatTestCase):
|
|||||||
utils.setup_dummy_db()
|
utils.setup_dummy_db()
|
||||||
self.ctx = utils.dummy_context()
|
self.ctx = utils.dummy_context()
|
||||||
|
|
||||||
t = template_format.parse(stack_template)
|
self.tmpl = template_format.parse(stack_template)
|
||||||
self.stack = utils.parse_stack(t)
|
self.stack = utils.parse_stack(self.tmpl)
|
||||||
resource_defns = self.stack.t.resource_definitions(self.stack)
|
resource_defns = self.stack.t.resource_definitions(self.stack)
|
||||||
self.rsrc_defn = resource_defns['cluster']
|
self.rsrc_defn = resource_defns['cluster']
|
||||||
|
|
||||||
@ -144,7 +145,9 @@ class TroveClusterTest(common.HeatTestCase):
|
|||||||
self.assertIsNone(tc.validate())
|
self.assertIsNone(tc.validate())
|
||||||
|
|
||||||
def test_validate_invalid_dsversion(self):
|
def test_validate_invalid_dsversion(self):
|
||||||
self.rsrc_defn['Properties']['datastore_version'] = '2.6.2'
|
props = self.tmpl['resources']['cluster']['properties'].copy()
|
||||||
|
props['datastore_version'] = '2.6.2'
|
||||||
|
self.rsrc_defn = self.rsrc_defn.freeze(properties=props)
|
||||||
tc = cluster.TroveCluster('cluster', self.rsrc_defn, self.stack)
|
tc = cluster.TroveCluster('cluster', self.rsrc_defn, self.stack)
|
||||||
ex = self.assertRaises(exception.StackValidationFailed, tc.validate)
|
ex = self.assertRaises(exception.StackValidationFailed, tc.validate)
|
||||||
error_msg = ('Datastore version 2.6.2 for datastore type mongodb is '
|
error_msg = ('Datastore version 2.6.2 for datastore type mongodb is '
|
||||||
@ -154,7 +157,9 @@ class TroveClusterTest(common.HeatTestCase):
|
|||||||
def test_validate_invalid_flavor(self):
|
def test_validate_invalid_flavor(self):
|
||||||
self.troveclient.flavors.get.side_effect = troveexc.NotFound()
|
self.troveclient.flavors.get.side_effect = troveexc.NotFound()
|
||||||
self.troveclient.flavors.find.side_effect = troveexc.NotFound()
|
self.troveclient.flavors.find.side_effect = troveexc.NotFound()
|
||||||
self.rsrc_defn['Properties']['instances'][0]['flavor'] = 'm1.small'
|
props = copy.deepcopy(self.tmpl['resources']['cluster']['properties'])
|
||||||
|
props['instances'][0]['flavor'] = 'm1.small'
|
||||||
|
self.rsrc_defn = self.rsrc_defn.freeze(properties=props)
|
||||||
tc = cluster.TroveCluster('cluster', self.rsrc_defn, self.stack)
|
tc = cluster.TroveCluster('cluster', self.rsrc_defn, self.stack)
|
||||||
ex = self.assertRaises(exception.StackValidationFailed, tc.validate)
|
ex = self.assertRaises(exception.StackValidationFailed, tc.validate)
|
||||||
error_msg = ("Property error: "
|
error_msg = ("Property error: "
|
||||||
|
@ -1391,11 +1391,13 @@ class HotStackTest(common.HeatTestCase):
|
|||||||
self.assertEqual('abc', self.stack['AResource'].properties['Foo'])
|
self.assertEqual('abc', self.stack['AResource'].properties['Foo'])
|
||||||
|
|
||||||
generic_rsrc.ResourceWithProps.update_template_diff(
|
generic_rsrc.ResourceWithProps.update_template_diff(
|
||||||
{'Type': 'ResourceWithPropsType',
|
rsrc_defn.ResourceDefinition('AResource',
|
||||||
'Properties': {'Foo': 'xyz'}},
|
'ResourceWithPropsType',
|
||||||
{'Type': 'ResourceWithPropsType',
|
properties={'Foo': 'xyz'}),
|
||||||
'Properties': {'Foo': 'abc'}}
|
rsrc_defn.ResourceDefinition('AResource',
|
||||||
).WithSideEffects(check_props).AndRaise(exception.UpdateReplace)
|
'ResourceWithPropsType',
|
||||||
|
properties={'Foo': 'abc'})
|
||||||
|
).WithSideEffects(check_props).AndRaise(exception.UpdateReplace)
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
|
|
||||||
self.stack.update(updated_stack)
|
self.stack.update(updated_stack)
|
||||||
@ -1435,11 +1437,13 @@ class HotStackTest(common.HeatTestCase):
|
|||||||
self.assertEqual('abc', self.stack['AResource'].properties['Foo'])
|
self.assertEqual('abc', self.stack['AResource'].properties['Foo'])
|
||||||
|
|
||||||
generic_rsrc.ResourceWithProps.update_template_diff(
|
generic_rsrc.ResourceWithProps.update_template_diff(
|
||||||
{'Type': 'ResourceWithPropsType',
|
rsrc_defn.ResourceDefinition('AResource',
|
||||||
'Properties': {'Foo': 'xyz'}},
|
'ResourceWithPropsType',
|
||||||
{'Type': 'ResourceWithPropsType',
|
properties={'Foo': 'xyz'}),
|
||||||
'Properties': {'Foo': 'abc'}}
|
rsrc_defn.ResourceDefinition('AResource',
|
||||||
).WithSideEffects(check_props).AndRaise(exception.UpdateReplace)
|
'ResourceWithPropsType',
|
||||||
|
properties={'Foo': 'abc'})
|
||||||
|
).WithSideEffects(check_props).AndRaise(exception.UpdateReplace)
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
|
|
||||||
self.stack.update(updated_stack)
|
self.stack.update(updated_stack)
|
||||||
|
@ -69,12 +69,12 @@ class nokeyTest(common.HeatTestCase):
|
|||||||
metadata = instance.metadata_get()
|
metadata = instance.metadata_get()
|
||||||
server_userdata = instance.client_plugin().build_userdata(
|
server_userdata = instance.client_plugin().build_userdata(
|
||||||
metadata,
|
metadata,
|
||||||
instance.t['Properties']['UserData'],
|
instance.properties['UserData'],
|
||||||
'ec2-user')
|
'ec2-user')
|
||||||
self.m.StubOutWithMock(nova.NovaClientPlugin, 'build_userdata')
|
self.m.StubOutWithMock(nova.NovaClientPlugin, 'build_userdata')
|
||||||
nova.NovaClientPlugin.build_userdata(
|
nova.NovaClientPlugin.build_userdata(
|
||||||
metadata,
|
metadata,
|
||||||
instance.t['Properties']['UserData'],
|
instance.properties['UserData'],
|
||||||
'ec2-user').AndReturn(server_userdata)
|
'ec2-user').AndReturn(server_userdata)
|
||||||
|
|
||||||
self.m.StubOutWithMock(self.fc.servers, 'create')
|
self.m.StubOutWithMock(self.fc.servers, 'create')
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import copy
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from heat.common import template_format
|
from heat.common import template_format
|
||||||
@ -74,7 +73,7 @@ class ServerTagsTest(common.HeatTestCase):
|
|||||||
|
|
||||||
t['Resources']['WebServer']['Properties']['Tags'] = intags
|
t['Resources']['WebServer']['Properties']['Tags'] = intags
|
||||||
resource_defns = template.resource_definitions(self.stack)
|
resource_defns = template.resource_definitions(self.stack)
|
||||||
instance = instances.Instance(stack_name,
|
instance = instances.Instance('WebServer',
|
||||||
resource_defns['WebServer'], self.stack)
|
resource_defns['WebServer'], self.stack)
|
||||||
|
|
||||||
self.m.StubOutWithMock(nova.NovaClientPlugin, '_create')
|
self.m.StubOutWithMock(nova.NovaClientPlugin, '_create')
|
||||||
@ -84,12 +83,12 @@ class ServerTagsTest(common.HeatTestCase):
|
|||||||
metadata = instance.metadata_get()
|
metadata = instance.metadata_get()
|
||||||
server_userdata = instance.client_plugin().build_userdata(
|
server_userdata = instance.client_plugin().build_userdata(
|
||||||
metadata,
|
metadata,
|
||||||
instance.t['Properties']['UserData'],
|
instance.properties['UserData'],
|
||||||
'ec2-user')
|
'ec2-user')
|
||||||
self.m.StubOutWithMock(nova.NovaClientPlugin, 'build_userdata')
|
self.m.StubOutWithMock(nova.NovaClientPlugin, 'build_userdata')
|
||||||
nova.NovaClientPlugin.build_userdata(
|
nova.NovaClientPlugin.build_userdata(
|
||||||
metadata,
|
metadata,
|
||||||
instance.t['Properties']['UserData'],
|
instance.properties['UserData'],
|
||||||
'ec2-user').AndReturn(server_userdata)
|
'ec2-user').AndReturn(server_userdata)
|
||||||
|
|
||||||
self.m.StubOutWithMock(self.fc.servers, 'create')
|
self.m.StubOutWithMock(self.fc.servers, 'create')
|
||||||
@ -138,8 +137,10 @@ class ServerTagsTest(common.HeatTestCase):
|
|||||||
self.stub_KeypairConstraint_validate()
|
self.stub_KeypairConstraint_validate()
|
||||||
self.stub_FlavorConstraint_validate()
|
self.stub_FlavorConstraint_validate()
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
update_template = copy.deepcopy(instance.t)
|
snippet = instance.stack.t.t['Resources'][instance.name]
|
||||||
update_template['Properties']['Tags'] = new_tags
|
props = snippet['Properties'].copy()
|
||||||
|
props['Tags'] = new_tags
|
||||||
|
update_template = instance.t.freeze(properties=props)
|
||||||
scheduler.TaskRunner(instance.update, update_template)()
|
scheduler.TaskRunner(instance.update, update_template)()
|
||||||
self.assertEqual((instance.UPDATE, instance.COMPLETE), instance.state)
|
self.assertEqual((instance.UPDATE, instance.COMPLETE), instance.state)
|
||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
|
@ -20,6 +20,7 @@ from heat.common import template_format
|
|||||||
from heat.db.sqlalchemy import api as db_api
|
from heat.db.sqlalchemy import api as db_api
|
||||||
from heat.engine import environment
|
from heat.engine import environment
|
||||||
from heat.engine import resource
|
from heat.engine import resource
|
||||||
|
from heat.engine import rsrc_defn
|
||||||
from heat.engine import scheduler
|
from heat.engine import scheduler
|
||||||
from heat.engine import service
|
from heat.engine import service
|
||||||
from heat.engine import stack
|
from heat.engine import stack
|
||||||
@ -405,11 +406,13 @@ class StackUpdateTest(common.HeatTestCase):
|
|||||||
self.assertEqual((stack.Stack.UPDATE, stack.Stack.COMPLETE),
|
self.assertEqual((stack.Stack.UPDATE, stack.Stack.COMPLETE),
|
||||||
self.stack.state)
|
self.stack.state)
|
||||||
self.assertEqual('xyz', self.stack['AResource'].properties['Foo'])
|
self.assertEqual('xyz', self.stack['AResource'].properties['Foo'])
|
||||||
mock_upd.assert_called_once_with(
|
after = rsrc_defn.ResourceDefinition('AResource',
|
||||||
{'Type': 'ResourceWithPropsType',
|
'ResourceWithPropsType',
|
||||||
'Properties': {'Foo': 'xyz'}},
|
properties={'Foo': 'xyz'})
|
||||||
{'Type': 'ResourceWithPropsType',
|
before = rsrc_defn.ResourceDefinition('AResource',
|
||||||
'Properties': {'Foo': 'abc'}})
|
'ResourceWithPropsType',
|
||||||
|
properties={'Foo': 'abc'})
|
||||||
|
mock_upd.assert_called_once_with(after, before)
|
||||||
|
|
||||||
def test_update_replace_create_hook(self):
|
def test_update_replace_create_hook(self):
|
||||||
tmpl = {
|
tmpl = {
|
||||||
@ -549,7 +552,8 @@ class StackUpdateTest(common.HeatTestCase):
|
|||||||
self.assertEqual((stack.Stack.UPDATE, stack.Stack.FAILED),
|
self.assertEqual((stack.Stack.UPDATE, stack.Stack.FAILED),
|
||||||
self.stack.state)
|
self.stack.state)
|
||||||
mock_upd.assert_called_once_with(
|
mock_upd.assert_called_once_with(
|
||||||
tmpl2['Resources']['AResource'],
|
rsrc_defn.ResourceDefinition('AResource', 'ResourceWithPropsType',
|
||||||
|
properties={'Foo': 'xyz'}),
|
||||||
mock.ANY,
|
mock.ANY,
|
||||||
{'Foo': 'xyz'})
|
{'Foo': 'xyz'})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user