From 19e84384e66b5ea4d3ffced26eeb52481ac9dd7b Mon Sep 17 00:00:00 2001 From: Eyal Date: Mon, 17 Dec 2018 09:29:44 +0200 Subject: [PATCH] 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 --- vitrage_tempest_plugin/tests/common/heat_utils.py | 4 ++-- .../tests/datasources/test_heat_stack.py | 6 +++++- .../tests/resources/heat/heat_nested_template.yaml | 7 +++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/vitrage_tempest_plugin/tests/common/heat_utils.py b/vitrage_tempest_plugin/tests/common/heat_utils.py index a9823d5..9e1ab5f 100644 --- a/vitrage_tempest_plugin/tests/common/heat_utils.py +++ b/vitrage_tempest_plugin/tests/common/heat_utils.py @@ -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, diff --git a/vitrage_tempest_plugin/tests/datasources/test_heat_stack.py b/vitrage_tempest_plugin/tests/datasources/test_heat_stack.py index 6b36235..cc7c74f 100644 --- a/vitrage_tempest_plugin/tests/datasources/test_heat_stack.py +++ b/vitrage_tempest_plugin/tests/datasources/test_heat_stack.py @@ -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) diff --git a/vitrage_tempest_plugin/tests/resources/heat/heat_nested_template.yaml b/vitrage_tempest_plugin/tests/resources/heat/heat_nested_template.yaml index dc5b942..8f12b37 100644 --- a/vitrage_tempest_plugin/tests/resources/heat/heat_nested_template.yaml +++ b/vitrage_tempest_plugin/tests/resources/heat/heat_nested_template.yaml @@ -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}