Add test to CloudFormation and PrimaryPrivateIpAddress GetAtt

This test would raise an error before d4e39146b7
This commit is contained in:
Hugo Lopes Tavares 2019-03-27 16:28:18 -04:00
parent d4e39146b7
commit 7c62f4a75c
2 changed files with 8 additions and 0 deletions

View File

@ -29,6 +29,10 @@ template = {
"NinjaENI": {
"Description": "Elastic IP mapping to Auto-Scaling Group",
"Value": {"Ref": "ENI"}
},
"ENIIpAddress": {
"Description": "ENI's Private IP address",
"Value": {"Fn::GetAtt": ["ENI", "PrimaryPrivateIpAddress"]}
}
}
}

View File

@ -355,9 +355,13 @@ def test_elastic_network_interfaces_cloudformation():
)
ec2_conn = boto.ec2.connect_to_region("us-west-1")
eni = ec2_conn.get_all_network_interfaces()[0]
eni.private_ip_addresses.should.have.length_of(1)
stack = conn.describe_stacks()[0]
resources = stack.describe_resources()
cfn_eni = [resource for resource in resources if resource.resource_type ==
'AWS::EC2::NetworkInterface'][0]
cfn_eni.physical_resource_id.should.equal(eni.id)
outputs = {output.key: output.value for output in stack.outputs}
outputs['ENIIpAddress'].should.equal(eni.private_ip_addresses[0].private_ip_address)