From 4737d8aafbe9bdf8f94732a5db1e1a74ef6a2745 Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Wed, 11 Mar 2015 13:46:42 +1300 Subject: [PATCH] Func test conf to specify boot config This adds a functional test config option boot_config_env which can specify a path to an environment file which defines boot config resources for any test which needs the heat agent projects. By default this value points to boot_config_none_env.yaml, which assumes the image is already completely configured with the heat agent projects. The aim is that in the gate jobs the following will be set: boot_config_env=/opt/stack/new/heat-templates/hot/software-config/boot-config/test_image_env.yaml And the image_ref will refer to the latest built image in http://tarballs.openstack.org/heat-test-image/ Change-Id: I1fa09bf3a8be248829061b931dd773973732fa52 --- heat_integrationtests/common/config.py | 6 ++++++ .../scenario/templates/boot_config_none_env.yaml | 5 +++++ .../scenario/templates/test_server_software_config.yaml | 8 ++------ .../scenario/test_server_software_config.py | 9 +++++++-- 4 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 heat_integrationtests/scenario/templates/boot_config_none_env.yaml diff --git a/heat_integrationtests/common/config.py b/heat_integrationtests/common/config.py index d4d41b0bff..878cd33c28 100644 --- a/heat_integrationtests/common/config.py +++ b/heat_integrationtests/common/config.py @@ -68,6 +68,12 @@ IntegrationTestGroup = [ cfg.StrOpt('fixed_network_name', default='private', help="Visible fixed network name "), + cfg.StrOpt('boot_config_env', + default='heat_integrationtests/scenario/templates' + '/boot_config_none_env.yaml', + help="Path to environment file which defines the " + "resource type Heat::InstallConfigAgent. Needs to " + "be appropriate for the image_ref."), cfg.StrOpt('fixed_subnet_name', default='private-subnet', help="Visible fixed sub-network name "), diff --git a/heat_integrationtests/scenario/templates/boot_config_none_env.yaml b/heat_integrationtests/scenario/templates/boot_config_none_env.yaml new file mode 100644 index 0000000000..91d130cd70 --- /dev/null +++ b/heat_integrationtests/scenario/templates/boot_config_none_env.yaml @@ -0,0 +1,5 @@ +# Defines a Heat::InstallConfigAgent config resource which performs no config. +# This environment can be used when the image already has the required agents +# installed and configured. +resource_registry: + "Heat::InstallConfigAgent": "OS::Heat::SoftwareConfig" \ No newline at end of file diff --git a/heat_integrationtests/scenario/templates/test_server_software_config.yaml b/heat_integrationtests/scenario/templates/test_server_software_config.yaml index c173e2c6ce..bf8fa9bbc1 100644 --- a/heat_integrationtests/scenario/templates/test_server_software_config.yaml +++ b/heat_integrationtests/scenario/templates/test_server_software_config.yaml @@ -136,11 +136,7 @@ resources: signal_transport: {get_param: signal_transport} cfg_user_data: - type: OS::Heat::SoftwareConfig - properties: - config: | - #!/bin/sh - echo "user data script" + type: Heat::InstallConfigAgent server: type: OS::Nova::Server @@ -154,7 +150,7 @@ resources: - network: {get_param: network} user_data_format: SOFTWARE_CONFIG software_config_transport: {get_param: software_config_transport} - user_data: {get_resource: cfg_user_data} + user_data: {get_attr: [cfg_user_data, config]} outputs: res1: diff --git a/heat_integrationtests/scenario/test_server_software_config.py b/heat_integrationtests/scenario/test_server_software_config.py index 86672c5f71..2df815bc56 100644 --- a/heat_integrationtests/scenario/test_server_software_config.py +++ b/heat_integrationtests/scenario/test_server_software_config.py @@ -10,6 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. +from heatclient.common import template_utils import six from heat_integrationtests.common import exceptions @@ -157,13 +158,17 @@ class SoftwareConfigIntegrationTest(scenario_base.ScenarioTestsBase): 'cfg3.pp': CFG3_PP } + env_files, env = template_utils.process_environment_and_files( + self.conf.boot_config_env) + # Launch stack self.stack_identifier = self.launch_stack( stack_name=self.stack_name, template_name='test_server_software_config.yaml', parameters=parameters, - files=files, - expected_status=None + files=dict(list(files.items()) + list(env_files.items())), + expected_status=None, + environment=env ) # Check stack