Merge "Use AWS::EC2::EIP for test_server_cfn_init"
diff --git a/scenario/templates/test_server_cfn_init.yaml b/scenario/templates/test_server_cfn_init.yaml
index 681e539..ffb8e9b 100644
--- a/scenario/templates/test_server_cfn_init.yaml
+++ b/scenario/templates/test_server_cfn_init.yaml
@@ -27,6 +27,12 @@
Type: AWS::IAM::AccessKey
Properties:
UserName: {Ref: CfnUser}
+
+ IPAddress:
+ Type: AWS::EC2::EIP
+ Properties:
+ InstanceId: {Ref: SmokeServer}
+
SmokeServer:
Type: AWS::EC2::Instance
Metadata:
@@ -78,4 +84,4 @@
SmokeServerIp:
Description: IP address of server
Value:
- Fn::GetAtt: [SmokeServer, PublicIp]
+ Ref: IPAddress
diff --git a/scenario/test_server_cfn_init.py b/scenario/test_server_cfn_init.py
index 1f12e71..cf74bd8 100644
--- a/scenario/test_server_cfn_init.py
+++ b/scenario/test_server_cfn_init.py
@@ -30,20 +30,13 @@
def check_stack(self, sid):
# Check status of all resources
for res in ('WaitHandle', 'SmokeSecurityGroup', 'SmokeKeys',
- 'CfnUser', 'SmokeServer'):
+ 'CfnUser', 'SmokeServer', 'IPAddress'):
self._wait_for_resource_status(
sid, res, 'CREATE_COMPLETE')
server_resource = self.client.resources.get(sid, 'SmokeServer')
server_id = server_resource.physical_resource_id
server = self.compute_client.servers.get(server_id)
- server_ip = server.networks[self.conf.network_for_ssh][0]
-
- # Check that created server is reachable
- if not self._ping_ip_address(server_ip):
- self._log_console_output(servers=[server])
- self.fail(
- "Timed out waiting for %s to become reachable" % server_ip)
try:
self._wait_for_resource_status(
@@ -72,6 +65,14 @@
self._stack_output(stack, 'WaitConditionStatus'))
self.assertEqual('smoke test complete', wait_status['smoke_status'])
+ server_ip = self._stack_output(stack, 'SmokeServerIp')
+
+ # Check that created server is reachable
+ if not self._ping_ip_address(server_ip):
+ self._log_console_output(servers=[server])
+ self.fail(
+ "Timed out waiting for %s to become reachable" % server_ip)
+
# Check that the user can authenticate with the generated keypair
if self.keypair:
try:
@@ -106,7 +107,8 @@
# Launch stack
stack_id = self.launch_stack(
template_name="test_server_cfn_init.yaml",
- parameters=parameters
+ parameters=parameters,
+ expected_status=None
)
# Check stack