summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAron Kyle <aron.kyle@lightspeedretail.com>2014-10-31 09:32:24 -0400
committerAron Kyle <aron.kyle@lightspeedretail.com>2015-03-19 19:07:39 -0400
commitdc33c30ee24623c3cc6418bcdaa5c1254ae45b21 (patch)
treea0ab2f765b026d4088fd23704a975b1c8283a45a /tests
parent4ffd9babf7f3812b5a573cc50afc5ec458984c11 (diff)
downloadboto-dc33c30ee24623c3cc6418bcdaa5c1254ae45b21.tar.gz
Issue 2296. Adding support for UsePreviousValue.
Adding support for cloudformation UsePreviousValue parameter.
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/cloudformation/test_connection.py57
-rw-r--r--tests/unit/cloudformation/test_connection.py12
2 files changed, 63 insertions, 6 deletions
diff --git a/tests/integration/cloudformation/test_connection.py b/tests/integration/cloudformation/test_connection.py
index 6529cc37..4cafb0fe 100644
--- a/tests/integration/cloudformation/test_connection.py
+++ b/tests/integration/cloudformation/test_connection.py
@@ -10,6 +10,14 @@ BASIC_EC2_TEMPLATE = {
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "AWS CloudFormation Sample Template EC2InstanceSample",
"Parameters": {
+ "Parameter1": {
+ "Description": "Test Parameter 1",
+ "Type": "String"
+ },
+ "Parameter2": {
+ "Description": "Test Parameter 2",
+ "Type": "String"
+ }
},
"Mappings": {
"RegionMap": {
@@ -32,7 +40,14 @@ BASIC_EC2_TEMPLATE = {
]
},
"UserData": {
- "Fn::Base64": "a" * 15000
+ "Fn::Base64": {
+ "Fn::Join":[
+ "",
+ [{"Ref": "Parameter1"},
+ {"Ref": "Parameter2"}]
+ ]
+ }
+
}
}
}
@@ -102,7 +117,9 @@ class TestCloudformationConnection(unittest.TestCase):
# See https://github.com/boto/boto/issues/1037
body = self.connection.create_stack(
self.stack_name,
- template_body=json.dumps(BASIC_EC2_TEMPLATE))
+ template_body=json.dumps(BASIC_EC2_TEMPLATE),
+ parameters=[('Parameter1', 'initial_value'),
+ ('Parameter2', 'initial_value')])
self.addCleanup(self.connection.delete_stack, self.stack_name)
# A newly created stack should have events
@@ -114,9 +131,39 @@ class TestCloudformationConnection(unittest.TestCase):
self.assertEqual(None, policy)
# Our new stack should show up in the stack list
- stacks = self.connection.describe_stacks()
- self.assertEqual(self.stack_name, stacks[0].stack_name)
-
+ stacks = self.connection.describe_stacks(self.stack_name)
+ stack = stacks[0]
+ self.assertEqual(self.stack_name, stack.stack_name)
+
+ params = [(p.key, p.value) for p in stack.parameters]
+ self.assertEquals([('Parameter1', 'initial_value'),
+ ('Parameter2', 'initial_value')], params)
+
+ for _ in range(30):
+ stack.update()
+ if stack.stack_status.find("PROGRESS") == -1:
+ break
+ time.sleep(5)
+
+ body = self.connection.update_stack(
+ self.stack_name,
+ template_body=json.dumps(BASIC_EC2_TEMPLATE),
+ parameters=[('Parameter1', '', True),
+ ('Parameter2', 'updated_value')])
+
+ stacks = self.connection.describe_stacks(self.stack_name)
+ stack = stacks[0]
+ params = [(p.key, p.value) for p in stacks[0].parameters]
+ self.assertEquals([('Parameter1', 'initial_value'),
+ ('Parameter2', 'updated_value')], params)
+ # Waiting for the update to complete to unblock the delete_stack in the
+ # cleanup.
+ for _ in range(30):
+ stack.update()
+ if stack.stack_status.find("PROGRESS") == -1:
+ break
+ time.sleep(5)
+
if __name__ == '__main__':
unittest.main()
diff --git a/tests/unit/cloudformation/test_connection.py b/tests/unit/cloudformation/test_connection.py
index f4e23f37..613e3d2a 100644
--- a/tests/unit/cloudformation/test_connection.py
+++ b/tests/unit/cloudformation/test_connection.py
@@ -134,7 +134,9 @@ class TestCloudFormationUpdateStack(CloudFormationConnectionBase):
api_response = self.service_connection.update_stack(
'stack_name', template_url='http://url',
template_body=SAMPLE_TEMPLATE,
- parameters=[('KeyName', 'myKeyName')],
+ parameters=[('KeyName', 'myKeyName'), ('KeyName2', "", True),
+ ('KeyName3', "", False), ('KeyName4', None, True),
+ ('KeyName5', "Ignore Me", True)],
tags={'TagKey': 'TagValue'},
notification_arns=['arn:notify1', 'arn:notify2'],
disable_rollback=True,
@@ -149,6 +151,14 @@ class TestCloudFormationUpdateStack(CloudFormationConnectionBase):
'NotificationARNs.member.2': 'arn:notify2',
'Parameters.member.1.ParameterKey': 'KeyName',
'Parameters.member.1.ParameterValue': 'myKeyName',
+ 'Parameters.member.2.ParameterKey': 'KeyName2',
+ 'Parameters.member.2.UsePreviousValue': 'true',
+ 'Parameters.member.3.ParameterKey': 'KeyName3',
+ 'Parameters.member.3.ParameterValue': '',
+ 'Parameters.member.4.UsePreviousValue': 'true',
+ 'Parameters.member.4.ParameterKey': 'KeyName4',
+ 'Parameters.member.5.UsePreviousValue': 'true',
+ 'Parameters.member.5.ParameterKey': 'KeyName5',
'Tags.member.1.Key': 'TagKey',
'Tags.member.1.Value': 'TagValue',
'StackName': 'stack_name',