Adds coverage for AWS EIP resource in scenario tests
Change-Id: Ie37fd388ba3d6c7bc5ec03609d7d27c84ab474cc Closes-Bug: #1269551
This commit is contained in:
parent
cf7d64979a
commit
c4d6d66e69
@ -28,10 +28,16 @@ Resources:
|
|||||||
Properties:
|
Properties:
|
||||||
UserName: {Ref: CfnUser}
|
UserName: {Ref: CfnUser}
|
||||||
|
|
||||||
IPAddress:
|
ElasticIp:
|
||||||
Type: AWS::EC2::EIP
|
Type: AWS::EC2::EIP
|
||||||
Properties:
|
Properties:
|
||||||
InstanceId: {Ref: SmokeServer}
|
Domain: vpc
|
||||||
|
|
||||||
|
SmokeServerElasticIp:
|
||||||
|
Type: AWS::EC2::EIPAssociation
|
||||||
|
Properties:
|
||||||
|
EIP: {Ref: ElasticIp}
|
||||||
|
InstanceId: {Ref: SmokeServer}
|
||||||
|
|
||||||
SmokeServer:
|
SmokeServer:
|
||||||
Type: AWS::EC2::Instance
|
Type: AWS::EC2::Instance
|
||||||
@ -81,7 +87,11 @@ Outputs:
|
|||||||
Description: Contents of /tmp/smoke-status on SmokeServer
|
Description: Contents of /tmp/smoke-status on SmokeServer
|
||||||
Value:
|
Value:
|
||||||
Fn::GetAtt: [WaitCondition, Data]
|
Fn::GetAtt: [WaitCondition, Data]
|
||||||
SmokeServerIp:
|
ElasticIp_Id:
|
||||||
Description: IP address of server
|
Description: Elastic ip allocation id
|
||||||
Value:
|
Value:
|
||||||
Ref: IPAddress
|
Fn::GetAtt: [ElasticIp, AllocationId]
|
||||||
|
SmokeServerElasticIp:
|
||||||
|
Description: Elastic ip address of server
|
||||||
|
Value:
|
||||||
|
Ref: ElasticIp
|
||||||
|
@ -27,7 +27,7 @@ class CfnInitIntegrationTest(scenario_base.ScenarioTestsBase):
|
|||||||
def check_stack(self, sid):
|
def check_stack(self, sid):
|
||||||
# Check status of all resources
|
# Check status of all resources
|
||||||
for res in ('WaitHandle', 'SmokeSecurityGroup', 'SmokeKeys',
|
for res in ('WaitHandle', 'SmokeSecurityGroup', 'SmokeKeys',
|
||||||
'CfnUser', 'SmokeServer', 'IPAddress'):
|
'CfnUser', 'SmokeServer', 'SmokeServerElasticIp'):
|
||||||
self._wait_for_resource_status(
|
self._wait_for_resource_status(
|
||||||
sid, res, 'CREATE_COMPLETE')
|
sid, res, 'CREATE_COMPLETE')
|
||||||
|
|
||||||
@ -59,7 +59,22 @@ class CfnInitIntegrationTest(scenario_base.ScenarioTestsBase):
|
|||||||
self._stack_output(stack, 'WaitConditionStatus'))
|
self._stack_output(stack, 'WaitConditionStatus'))
|
||||||
self.assertEqual('smoke test complete', wait_status['smoke_status'])
|
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
|
# Check that created server is reachable
|
||||||
if not self._ping_ip_address(server_ip):
|
if not self._ping_ip_address(server_ip):
|
||||||
|
Loading…
Reference in New Issue
Block a user