get the image for heat from glance

images are updated from time to time
image name should not be hardcoded in heat template.
get it from glance the same way instance creating in
tests is done

Change-Id: I1fbd0c2465979f4efa3da437f204eddb2decba9d
This commit is contained in:
Eyal 2018-12-17 09:29:44 +02:00
parent 1e881b6b88
commit 19e84384e6
3 changed files with 14 additions and 3 deletions

View File

@ -20,7 +20,7 @@ from vitrage_tempest_plugin.tests.common.tempest_clients import TempestClients
from vitrage_tempest_plugin.tests.utils import wait_for_status
def create_stacks(num_stacks, nested, template_file):
def create_stacks(num_stacks, nested, template_file, image):
tpl_files, template = template_utils.process_template_path(
template_file,
object_request=http.authenticated_fetcher(TempestClients.heat()))
@ -30,7 +30,7 @@ def create_stacks(num_stacks, nested, template_file):
TempestClients.heat().stacks.create(stack_name=stack_name,
template=template,
files=tpl_files,
parameters={})
parameters={'image': image})
wait_for_status(45,
_check_num_stacks,
num_stacks=num_stacks,

View File

@ -13,11 +13,13 @@
# under the License.
from oslo_log import log as logging
from vitrage_tempest_plugin.tests import utils
from vitrage_tempest_plugin.tests.api.topology.base import BaseTopologyTest
from vitrage_tempest_plugin.tests.common.general_utils\
import tempest_resources_dir
from vitrage_tempest_plugin.tests.common import glance_utils
from vitrage_tempest_plugin.tests.common import heat_utils
LOG = logging.getLogger(__name__)
@ -51,9 +53,11 @@ class TestHeatStack(BaseTopologyTest):
This test validate correctness topology graph with heat stack module
"""
template_file = tempest_resources_dir() + '/heat/' + tmpl_file
image = glance_utils.get_first_image()
try:
# Action
heat_utils.create_stacks(self.NUM_STACKS, nested, template_file)
heat_utils.create_stacks(self.NUM_STACKS, nested, template_file,
image['name'])
# Calculate expected results
api_graph = self.vitrage_client.topology.get(all_tenants=True)

View File

@ -3,6 +3,11 @@ heat_template_version: 2013-05-23
description: |
The heat template is used to demo
parameters:
image:
type: string
default: cirros-0.3.6-x86_64-disk
resources:
rg:
type: OS::Heat::ResourceGroup
@ -10,3 +15,5 @@ resources:
count: 1
resource_def:
type: server.yaml
properties:
image: {get_param: image}