Adds coverage for AWS EIP resource in scenario tests

Change-Id: Ie37fd388ba3d6c7bc5ec03609d7d27c84ab474cc
Closes-Bug: #1269551
This commit is contained in:
Rakesh H S 2015-07-15 17:44:41 +05:30
parent cf7d64979a
commit c4d6d66e69
2 changed files with 32 additions and 7 deletions

View File

@ -28,10 +28,16 @@ Resources:
Properties:
UserName: {Ref: CfnUser}
IPAddress:
ElasticIp:
Type: AWS::EC2::EIP
Properties:
InstanceId: {Ref: SmokeServer}
Domain: vpc
SmokeServerElasticIp:
Type: AWS::EC2::EIPAssociation
Properties:
EIP: {Ref: ElasticIp}
InstanceId: {Ref: SmokeServer}
SmokeServer:
Type: AWS::EC2::Instance
@ -81,7 +87,11 @@ Outputs:
Description: Contents of /tmp/smoke-status on SmokeServer
Value:
Fn::GetAtt: [WaitCondition, Data]
SmokeServerIp:
Description: IP address of server
ElasticIp_Id:
Description: Elastic ip allocation id
Value:
Ref: IPAddress
Fn::GetAtt: [ElasticIp, AllocationId]
SmokeServerElasticIp:
Description: Elastic ip address of server
Value:
Ref: ElasticIp

View File

@ -27,7 +27,7 @@ class CfnInitIntegrationTest(scenario_base.ScenarioTestsBase):
def check_stack(self, sid):
# Check status of all resources
for res in ('WaitHandle', 'SmokeSecurityGroup', 'SmokeKeys',
'CfnUser', 'SmokeServer', 'IPAddress'):
'CfnUser', 'SmokeServer', 'SmokeServerElasticIp'):
self._wait_for_resource_status(
sid, res, 'CREATE_COMPLETE')
@ -59,7 +59,22 @@ class CfnInitIntegrationTest(scenario_base.ScenarioTestsBase):
self._stack_output(stack, 'WaitConditionStatus'))
self.assertEqual('smoke test complete', wait_status['smoke_status'])
server_ip = self._stack_output(stack, 'SmokeServerIp')
# Check EIP attributes.
server_floatingip_id = self._stack_output(stack,
'ElasticIp_Id')
self.assertIsNotNone(server_floatingip_id)
# Fetch EIP details.
net_show = self.network_client.show_floatingip(
floatingip=server_floatingip_id)
floating_ip = net_show['floatingip']['floating_ip_address']
port_id = net_show['floatingip']['port_id']
# Ensure that EIP was assigned to server.
port_show = self.network_client.show_port(port=port_id)
self.assertEqual(server.id, port_show['port']['device_id'])
server_ip = self._stack_output(stack, 'SmokeServerElasticIp')
self.assertEqual(server_ip, floating_ip)
# Check that created server is reachable
if not self._ping_ip_address(server_ip):