Cfn change set fix outputs (#3033)
* set creation time of the change set * fix status, execution status, stak id, creation time and update tests
This commit is contained in:
parent
7a6d78afde
commit
8fa625c3de
@ -240,7 +240,8 @@ class FakeStack(BaseModel):
|
|||||||
self.resource_map = self._create_resource_map()
|
self.resource_map = self._create_resource_map()
|
||||||
self.output_map = self._create_output_map()
|
self.output_map = self._create_output_map()
|
||||||
if create_change_set:
|
if create_change_set:
|
||||||
self.status = "REVIEW_IN_PROGRESS"
|
self.status = "CREATE_COMPLETE"
|
||||||
|
self.execution_status = "AVAILABLE"
|
||||||
else:
|
else:
|
||||||
self.create_resources()
|
self.create_resources()
|
||||||
self._add_stack_event("CREATE_COMPLETE")
|
self._add_stack_event("CREATE_COMPLETE")
|
||||||
@ -397,6 +398,7 @@ class FakeChangeSet(FakeStack):
|
|||||||
self.change_set_id = change_set_id
|
self.change_set_id = change_set_id
|
||||||
self.change_set_name = change_set_name
|
self.change_set_name = change_set_name
|
||||||
self.changes = self.diff(template=template, parameters=parameters)
|
self.changes = self.diff(template=template, parameters=parameters)
|
||||||
|
self.creation_time = datetime.utcnow()
|
||||||
|
|
||||||
def diff(self, template, parameters=None):
|
def diff(self, template, parameters=None):
|
||||||
self.template = template
|
self.template = template
|
||||||
@ -587,7 +589,7 @@ class CloudFormationBackend(BaseBackend):
|
|||||||
if stack is None:
|
if stack is None:
|
||||||
raise ValidationError(stack_name)
|
raise ValidationError(stack_name)
|
||||||
else:
|
else:
|
||||||
stack_id = generate_stack_id(stack_name)
|
stack_id = generate_stack_id(stack_name, region_name)
|
||||||
stack_template = template
|
stack_template = template
|
||||||
|
|
||||||
change_set_id = generate_changeset_id(change_set_name, region_name)
|
change_set_id = generate_changeset_id(change_set_name, region_name)
|
||||||
|
@ -609,7 +609,7 @@ DESCRIBE_CHANGE_SET_RESPONSE_TEMPLATE = """<DescribeChangeSetResponse>
|
|||||||
</member>
|
</member>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</Parameters>
|
</Parameters>
|
||||||
<CreationTime>2011-05-23T15:47:44Z</CreationTime>
|
<CreationTime>{{ change_set.creation_time_iso_8601 }}</CreationTime>
|
||||||
<ExecutionStatus>{{ change_set.execution_status }}</ExecutionStatus>
|
<ExecutionStatus>{{ change_set.execution_status }}</ExecutionStatus>
|
||||||
<Status>{{ change_set.status }}</Status>
|
<Status>{{ change_set.status }}</Status>
|
||||||
<StatusReason>{{ change_set.status_reason }}</StatusReason>
|
<StatusReason>{{ change_set.status_reason }}</StatusReason>
|
||||||
|
@ -819,7 +819,7 @@ def test_create_change_set_from_s3_url():
|
|||||||
in response["Id"]
|
in response["Id"]
|
||||||
)
|
)
|
||||||
assert (
|
assert (
|
||||||
"arn:aws:cloudformation:us-east-1:123456789:stack/NewStack"
|
"arn:aws:cloudformation:us-west-1:123456789:stack/NewStack"
|
||||||
in response["StackId"]
|
in response["StackId"]
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -838,7 +838,12 @@ def test_describe_change_set():
|
|||||||
|
|
||||||
stack["ChangeSetName"].should.equal("NewChangeSet")
|
stack["ChangeSetName"].should.equal("NewChangeSet")
|
||||||
stack["StackName"].should.equal("NewStack")
|
stack["StackName"].should.equal("NewStack")
|
||||||
stack["Status"].should.equal("REVIEW_IN_PROGRESS")
|
stack["Status"].should.equal("CREATE_COMPLETE")
|
||||||
|
stack["ExecutionStatus"].should.equal("AVAILABLE")
|
||||||
|
two_secs_ago = datetime.now(tz=pytz.UTC) - timedelta(seconds=2)
|
||||||
|
assert (
|
||||||
|
two_secs_ago < stack["CreationTime"] < datetime.now(tz=pytz.UTC)
|
||||||
|
), "Change set should have been created recently"
|
||||||
|
|
||||||
cf_conn.create_change_set(
|
cf_conn.create_change_set(
|
||||||
StackName="NewStack",
|
StackName="NewStack",
|
||||||
@ -868,7 +873,7 @@ def test_execute_change_set_w_arn():
|
|||||||
)
|
)
|
||||||
ec2.describe_instances()["Reservations"].should.have.length_of(0)
|
ec2.describe_instances()["Reservations"].should.have.length_of(0)
|
||||||
cf_conn.describe_change_set(ChangeSetName="NewChangeSet")["Status"].should.equal(
|
cf_conn.describe_change_set(ChangeSetName="NewChangeSet")["Status"].should.equal(
|
||||||
"REVIEW_IN_PROGRESS"
|
"CREATE_COMPLETE"
|
||||||
)
|
)
|
||||||
# Execute change set
|
# Execute change set
|
||||||
cf_conn.execute_change_set(ChangeSetName=change_set["Id"])
|
cf_conn.execute_change_set(ChangeSetName=change_set["Id"])
|
||||||
|
Loading…
Reference in New Issue
Block a user