Add test for remote nested stacks

Add a scenario test with remote nested stacks:

   Local               Remote

  Root stack
    ----------------> Intermediate stack
                        - Base stack

Change-Id: If68f721181f502b3eb364dec13c8ef388d61f57d
Story: #1739447
Task: 22217
This commit is contained in:
Zane Bitter 2018-01-30 10:45:01 -05:00
parent 4ca172ae78
commit 2ec1acbf6c
4 changed files with 130 additions and 0 deletions

View File

@ -0,0 +1,29 @@
heat_template_version: 2015-10-15
description: |
The base stack (containing an actual resource) for the remote deeply-nested
stack test.
parameters:
name:
type: string
description: Name of the router
constraints:
- allowed_pattern: "[a-z][a-z0-9-]{1,}"
network_name:
type: string
description: The network to connect to
constraints:
- custom_constraint: neutron.network
resources:
router:
type: OS::Neutron::Router
properties:
name:
list_join: ['-', [{ get_param: name }, 'router']]
external_gateway_info:
network: {get_param: network_name}
outputs:
router:
value: {get_resource: router}

View File

@ -0,0 +1,27 @@
heat_template_version: 2015-10-15
description: |
The intermediate stack (containing a local nested stack) to be instantiated
remotely in the remote deeply-nested stack test.
parameters:
name:
type: string
description: Name of the router
constraints:
- allowed_pattern: "[a-z][a-z0-9-]{1,}"
network_name:
type: string
description: The public network to connect to
constraints:
- custom_constraint: neutron.network
resources:
network_stack_as_custom_type:
type: remote_nested_base.yaml
properties:
name: {get_param: name}
network_name: {get_param: network_name}
outputs:
router:
value: {get_attr: [network_stack_as_custom_type, router]}

View File

@ -0,0 +1,35 @@
heat_template_version: 2015-10-15
description: |
The root stack (containing a remote stack) for the deeply-nested remote
stack test.
parameters:
name:
type: string
description: Name of the router
constraints:
- allowed_pattern: "[a-z][a-z0-9-]{1,}"
network_name:
type: string
description: The public network to connect to
constraints:
- custom_constraint: neutron.network
region:
type: string
description: The region in which to create the remote stack
default: RegionOne
resources:
network_stack:
type: OS::Heat::Stack
properties:
template: {get_file: remote_nested_intermediate.yaml}
context:
region_name: {get_param: region}
parameters:
name: {get_param: name}
network_name: {get_param: network_name}
outputs:
router:
value: {get_attr: [network_stack, outputs, router]}

View File

@ -0,0 +1,39 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import six
import uuid
from heat_tempest_plugin.tests.scenario import scenario_base
from tempest.lib import decorators
class RemoteDeeplyNestedStackTest(scenario_base.ScenarioTestsBase):
@decorators.idempotent_id('2ed94cae-da14-4060-a6b3-526e7a8cbbe4')
def test_remote_nested(self):
parameters = {
'name': 'remote-nested',
'network_name': 'public',
}
stack_id = self.launch_stack(
template_name='remote_nested_root.yaml',
parameters={'region': self.conf.region},
environment={'parameters': parameters}
)
stack = self.client.stacks.get(stack_id)
router_id = self._stack_output(stack, 'router')
self.assertIsInstance(router_id, six.string_types)
uuid.UUID(router_id)
self._stack_delete(stack_id)