Make Heat's non_empty_stack usable without a server
We don't really need to test with a server to check Heat's
API responses. So just use a trivial resource type (a LaunchConfig)
to create some objects that we can query against. Now we can use
this test to gate.
Change-Id: I71bc065d8a1d2064ca90406543a376ce4d477275
diff --git a/tempest/api/orchestration/stacks/test_non_empty_stack.py b/tempest/api/orchestration/stacks/test_non_empty_stack.py
index 35a7326..b19344d 100644
--- a/tempest/api/orchestration/stacks/test_non_empty_stack.py
+++ b/tempest/api/orchestration/stacks/test_non_empty_stack.py
@@ -28,75 +28,57 @@
template = """
HeatTemplateFormatVersion: '2012-12-12'
Description: |
- Template which creates single EC2 instance
+ Template which creates some simple resources
Parameters:
- KeyName:
+ trigger:
Type: String
- InstanceType:
- Type: String
- ImageId:
- Type: String
- Subnet:
- Type: String
+ Default: not_yet
Resources:
- SmokeServer:
- Type: AWS::EC2::Instance
+ fluffy:
+ Type: AWS::AutoScaling::LaunchConfiguration
Metadata:
- Name: SmokeServer
+ kittens:
+ - Tom
+ - Stinky
Properties:
- ImageId: {Ref: ImageId}
- InstanceType: {Ref: InstanceType}
- KeyName: {Ref: KeyName}
- SubnetId: {Ref: Subnet}
+ ImageId: not_used
+ InstanceType: not_used
UserData:
- Fn::Base64:
- Fn::Join:
- - ''
- - - '#!/bin/bash -v
-
- '
- - /opt/aws/bin/cfn-signal -e 0 -r "SmokeServer created" '
- - {Ref: WaitHandle}
- - '''
-
- '
- WaitHandle:
- Type: AWS::CloudFormation::WaitConditionHandle
- WaitCondition:
- Type: AWS::CloudFormation::WaitCondition
- DependsOn: SmokeServer
- Properties:
- Handle: {Ref: WaitHandle}
- Timeout: '600'
+ Fn::Replace:
+ - variable_a: {Ref: trigger}
+ variable_b: bee
+ - |
+ A == variable_a
+ B == variable_b
+Outputs:
+ fluffy:
+ Description: "fluffies irc nick"
+ Value:
+ Fn::Replace:
+ - nick: {Ref: fluffy}
+ - |
+ #nick
"""
@classmethod
def setUpClass(cls):
super(StacksTestJSON, cls).setUpClass()
- if not cls.orchestration_cfg.image_ref:
- raise cls.skipException("No image available to test")
cls.client = cls.orchestration_client
cls.stack_name = data_utils.rand_name('heat')
- keypair_name = (cls.orchestration_cfg.keypair_name or
- cls._create_keypair()['name'])
# create the stack
- subnet = cls._get_default_network()['subnets'][0]
cls.stack_identifier = cls.create_stack(
cls.stack_name,
cls.template,
parameters={
- 'KeyName': keypair_name,
- 'InstanceType': cls.orchestration_cfg.instance_type,
- 'ImageId': cls.orchestration_cfg.image_ref,
- 'Subnet': subnet
+ 'trigger': 'start'
})
cls.stack_id = cls.stack_identifier.split('/')[1]
- cls.resource_name = 'SmokeServer'
- cls.resource_type = 'AWS::EC2::Instance'
+ cls.resource_name = 'fluffy'
+ cls.resource_type = 'AWS::AutoScaling::LaunchConfiguration'
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
- @attr(type='slow')
+ @attr(type='gate')
def test_stack_list(self):
"""Created stack should be on the list of existing stacks."""
resp, stacks = self.client.list_stacks()
@@ -105,7 +87,7 @@
stacks_names = map(lambda stack: stack['stack_name'], stacks)
self.assertIn(self.stack_name, stacks_names)
- @attr(type='slow')
+ @attr(type='gate')
def test_stack_show(self):
"""Getting details about created stack should be possible."""
resp, stack = self.client.get_stack(self.stack_name)
@@ -114,7 +96,7 @@
self.assertEqual(self.stack_name, stack['stack_name'])
self.assertEqual(self.stack_id, stack['id'])
- @attr(type='slow')
+ @attr(type='gate')
def test_list_resources(self):
"""Getting list of created resources for the stack should be possible.
"""
@@ -128,7 +110,7 @@
resources)
self.assertIn(self.resource_type, resources_types)
- @attr(type='slow')
+ @attr(type='gate')
def test_show_resource(self):
"""Getting details about created resource should be possible."""
resp, resource = self.client.get_resource(self.stack_identifier,
@@ -137,7 +119,7 @@
self.assertEqual(self.resource_name, resource['logical_resource_id'])
self.assertEqual(self.resource_type, resource['resource_type'])
- @attr(type='slow')
+ @attr(type='gate')
def test_resource_metadata(self):
"""Getting metadata for created resource should be possible."""
resp, metadata = self.client.show_resource_metadata(
@@ -145,9 +127,9 @@
self.resource_name)
self.assertEqual('200', resp['status'])
self.assertIsInstance(metadata, dict)
- self.assertEqual(self.resource_name, metadata.get('Name', None))
+ self.assertEqual(['Tom', 'Stinky'], metadata.get('kittens', None))
- @attr(type='slow')
+ @attr(type='gate')
def test_list_events(self):
"""Getting list of created events for the stack should be possible."""
resp, events = self.client.list_events(self.stack_identifier)
@@ -157,7 +139,7 @@
self.assertIn('CREATE_IN_PROGRESS', resource_statuses)
self.assertIn('CREATE_COMPLETE', resource_statuses)
- @attr(type='slow')
+ @attr(type='gate')
def test_show_event(self):
"""Getting details about existing event should be possible."""
resp, events = self.client.list_resource_events(self.stack_identifier,
@@ -168,7 +150,7 @@
resp, event = self.client.show_event(self.stack_identifier,
self.resource_name, event_id)
self.assertEqual('200', resp['status'])
- self.assertEqual('CREATE_IN_PROGRESS', event['resource_status'])
+ self.assertIsInstance(event, dict)
+ self.assertEqual(self.resource_name, event['resource_name'])
self.assertEqual('state changed', event['resource_status_reason'])
self.assertEqual(self.resource_name, event['logical_resource_id'])
- self.assertIsInstance(event, dict)