The heat_integrationtests.functional.test_template_resource Module

class heat_integrationtests.functional.test_template_resource.NestedAttributesTest(*args, **kwargs)[source]

Bases: heat_integrationtests.functional.functional_base.FunctionalTestsBase

Prove that we can use the template resource references.

env_templ = ‘\nresource_registry:\n “My::NestedSecret”: nested.yaml\n’
main_templ = ‘\nheat_template_version: 2014-10-16\nresources:\n secret2:\n type: My::NestedSecret\noutputs:\n old_way:\n value: { get_attr: [secret2, nested_str]}\n test_attr1:\n value: { get_attr: [secret2, resource.secret1, value]}\n test_attr2:\n value: { get_attr: [secret2, resource.secret1.value]}\n test_ref:\n value: { get_resource: secret2 }\n’
test_nested_attributes()[source]
test_stack_ref()[source]
test_transparent_ref()[source]

Test using nested resource more transparently.

With the addition of OS::stack_id we can now use the nested resource more transparently.

class heat_integrationtests.functional.test_template_resource.TemplateResourceAdoptTest(*args, **kwargs)[source]

Bases: heat_integrationtests.functional.functional_base.FunctionalTestsBase

Prove that we can do template resource adopt/abandon.

main_template = “\nHeatTemplateFormatVersion: ‘2012-12-12’\nResources:\n the_nested:\n Type: the.yaml\n Properties:\n one: my_name\nOutputs:\n identifier:\n Value: {Ref: the_nested}\n value:\n Value: {‘Fn::GetAtt’: [the_nested, the_str]}\n”
nested_templ = “\nHeatTemplateFormatVersion: ‘2012-12-12’\nParameters:\n one:\n Default: foo\n Type: String\nResources:\n RealRandom:\n Type: OS::Heat::RandomString\n Properties:\n salt: {Ref: one}\nOutputs:\n the_str:\n Value: {‘Fn::GetAtt’: [RealRandom, value]}\n”
test_abandon()[source]
test_adopt()[source]
class heat_integrationtests.functional.test_template_resource.TemplateResourceCheckTest(*args, **kwargs)[source]

Bases: heat_integrationtests.functional.functional_base.FunctionalTestsBase

Prove that we can do template resource check.

main_template = “\nHeatTemplateFormatVersion: ‘2012-12-12’\nResources:\n the_nested:\n Type: the.yaml\n Properties:\n one: my_name\nOutputs:\n identifier:\n Value: {Ref: the_nested}\n value:\n Value: {‘Fn::GetAtt’: [the_nested, the_str]}\n”
nested_templ = “\nHeatTemplateFormatVersion: ‘2012-12-12’\nParameters:\n one:\n Default: foo\n Type: String\nResources:\n RealRandom:\n Type: OS::Heat::RandomString\n Properties:\n salt: {Ref: one}\nOutputs:\n the_str:\n Value: {‘Fn::GetAtt’: [RealRandom, value]}\n”
test_check()[source]
class heat_integrationtests.functional.test_template_resource.TemplateResourceErrorMessageTest(*args, **kwargs)[source]

Bases: heat_integrationtests.functional.functional_base.FunctionalTestsBase

Prove that nested stack errors don’t suck.

nested_templ = “\nHeatTemplateFormatVersion: ‘2012-12-12’\nResources:\n oops:\n Type: OS::Heat::TestResource\n Properties:\n fail: true\n wait_secs: 2\n”
template = “\nHeatTemplateFormatVersion: ‘2012-12-12’\nResources:\n victim:\n Type: fail.yaml\n”
test_fail()[source]
class heat_integrationtests.functional.test_template_resource.TemplateResourceFacadeTest(*args, **kwargs)[source]

Bases: heat_integrationtests.functional.functional_base.FunctionalTestsBase

Prove that we can use ResourceFacade in a HOT template.

main_template = ‘\nheat_template_version: 2013-05-23\nresources:\n the_nested:\n type: the.yaml\n metadata:\n foo: bar\noutputs:\n value:\n value: {get_attr: [the_nested, output]}\n’
nested_templ = ‘\nheat_template_version: 2013-05-23\nresources:\n test:\n type: OS::Heat::TestResource\n properties:\n value: {“Fn::Select”: [foo, {resource_facade: metadata}]}\noutputs:\n output:\n value: {get_attr: [test, output]}\n ‘
test_metadata()[source]
class heat_integrationtests.functional.test_template_resource.TemplateResourceNewParamTest(*args, **kwargs)[source]

Bases: heat_integrationtests.functional.functional_base.FunctionalTestsBase

main_template = ‘\nheat_template_version: 2013-05-23\nresources:\n my_resource:\n type: resource.yaml\n properties:\n value1: foo\n’
main_template_update = ‘\nheat_template_version: 2013-05-23\nresources:\n my_resource:\n type: resource.yaml\n properties:\n value1: foo\n value2: foo\n’
nested_templ = ‘\nheat_template_version: 2013-05-23\nparameters:\n value1:\n type: string\nresources:\n test:\n type: OS::Heat::TestResource\n properties:\n value: {get_param: value1}\n’
nested_templ_update = ‘\nheat_template_version: 2013-05-23\nparameters:\n value1:\n type: string\n value2:\n type: string\nresources:\n test:\n type: OS::Heat::TestResource\n properties:\n value:\n str_replace:\n template: VAL1-VAL2\n params:\n VAL1: {get_param: value1}\n VAL2: {get_param: value2}\n’
nested_templ_update_fail = ‘\nheat_template_version: 2013-05-23\nparameters:\n value1:\n type: string\n value2:\n type: string\nresources:\n test:\n type: OS::Heat::TestResource\n properties:\n fail: True\n value:\n str_replace:\n template: VAL1-VAL2\n params:\n VAL1: {get_param: value1}\n VAL2: {get_param: value2}\n’
test_update()[source]
class heat_integrationtests.functional.test_template_resource.TemplateResourceRemovedParamTest(*args, **kwargs)[source]

Bases: heat_integrationtests.functional.functional_base.FunctionalTestsBase

main_template = ‘\nheat_template_version: 2013-05-23\nparameters:\n value1:\n type: string\n default: foo\nresources:\n my_resource:\n type: resource.yaml\n properties:\n value1: {get_param: value1}\n’
main_template_update = ‘\nheat_template_version: 2013-05-23\nresources:\n my_resource:\n type: resource.yaml\n’
nested_templ = ‘\nheat_template_version: 2013-05-23\nparameters:\n value1:\n type: string\n default: foo\nresources:\n test:\n type: OS::Heat::TestResource\n properties:\n value: {get_param: value1}\n’
nested_templ_update = ‘\nheat_template_version: 2013-05-23\nparameters:\n value1:\n type: string\n default: foo\n value2:\n type: string\n default: bar\nresources:\n test:\n type: OS::Heat::TestResource\n properties:\n value:\n str_replace:\n template: VAL1-VAL2\n params:\n VAL1: {get_param: value1}\n VAL2: {get_param: value2}\n’
test_update()[source]
class heat_integrationtests.functional.test_template_resource.TemplateResourceSuspendResumeTest(*args, **kwargs)[source]

Bases: heat_integrationtests.functional.functional_base.FunctionalTestsBase

Prove that we can do template resource suspend/resume.

main_template = ‘\nheat_template_version: 2014-10-16\nparameters:\nresources:\n the_nested:\n type: the.yaml\n’
nested_templ = ‘\nheat_template_version: 2014-10-16\nresources:\n test_random_string:\n type: OS::Heat::RandomString\n’
test_suspend_resume()[source]

Basic test for template resource suspend resume.

class heat_integrationtests.functional.test_template_resource.TemplateResourceTest(*args, **kwargs)[source]

Bases: heat_integrationtests.functional.functional_base.FunctionalTestsBase

Prove that we can use the registry in a nested provider.

env_templ = ‘\nresource_registry:\n “OS::Heat::RandomString”: nested.yaml\n’
nested_templ = ‘\nheat_template_version: 2013-05-23\nresources:\n secret2:\n type: OS::Heat::RandomString\noutputs:\n value:\n value: { get_attr: [secret2, value] }\n’
template = ‘\nheat_template_version: 2013-05-23\nresources:\n secret1:\n type: OS::Heat::RandomString\noutputs:\n secret-out:\n value: { get_attr: [secret1, value] }\n’
test_change_in_file_path()[source]
test_nested_env()[source]
test_nested_stack_delete_then_delete_parent_stack()[source]

Check the robustness of stack deletion.

This tests that if you manually delete a nested stack, the parent stack is still deletable.

test_no_infinite_recursion()[source]

Prove that we can override a python resource.

And use that resource within the template resource.

class heat_integrationtests.functional.test_template_resource.TemplateResourceUpdateFailedTest(*args, **kwargs)[source]

Bases: heat_integrationtests.functional.functional_base.FunctionalTestsBase

Prove that we can do updates on a nested stack to fix a stack.

main_template = “\nHeatTemplateFormatVersion: ‘2012-12-12’\nResources:\n keypair:\n Type: OS::Nova::KeyPair\n Properties:\n name: replace-this\n save_private_key: false\n server:\n Type: server_fail.yaml\n DependsOn: keypair\n”
nested_templ = “\nHeatTemplateFormatVersion: ‘2012-12-12’\nResources:\n RealRandom:\n Type: OS::Heat::RandomString\n”
setUp()[source]
test_update_on_failed_create()[source]
class heat_integrationtests.functional.test_template_resource.TemplateResourceUpdateTest(*args, **kwargs)[source]

Bases: heat_integrationtests.functional.functional_base.FunctionalTestsBase

Prove that we can do template resource updates.

EXPECTED = (‘update’, ‘nochange’)
NOCHANGE = ‘nochange’
UPDATE = ‘update’
attr_change_tmpl = “\nHeatTemplateFormatVersion: ‘2012-12-12’\nParameters:\n one:\n Default: foo\n Type: String\n two:\n Default: bar\n Type: String\n\nResources:\n NestedResource:\n Type: OS::Heat::RandomString\n Properties:\n salt: {Ref: one}\nOutputs:\n the_str:\n Value: {‘Fn::GetAtt’: [NestedResource, value]}\n something_else:\n Value: just_a_string\n”
content_change_tmpl = “\nHeatTemplateFormatVersion: ‘2012-12-12’\nParameters:\n one:\n Default: foo\n Type: String\n two:\n Default: bar\n Type: String\n\nResources:\n NestedResource:\n Type: OS::Heat::RandomString\n Properties:\n salt: yum\nOutputs:\n the_str:\n Value: {‘Fn::GetAtt’: [NestedResource, value]}\n”
initial_tmpl = “\nHeatTemplateFormatVersion: ‘2012-12-12’\nParameters:\n one:\n Default: foo\n Type: String\n two:\n Default: bar\n Type: String\n\nResources:\n NestedResource:\n Type: OS::Heat::RandomString\n Properties:\n salt: {Ref: one}\nOutputs:\n the_str:\n Value: {‘Fn::GetAtt’: [NestedResource, value]}\n”
main_template = “\nHeatTemplateFormatVersion: ‘2012-12-12’\nResources:\n the_nested:\n Type: the.yaml\n Properties:\n one: my_name\n two: your_name\nOutputs:\n identifier:\n Value: {Ref: the_nested}\n value:\n Value: {‘Fn::GetAtt’: [the_nested, the_str]}\n”
main_template_add_prop = “\nHeatTemplateFormatVersion: ‘2012-12-12’\nResources:\n the_nested:\n Type: the.yaml\n Properties:\n one: my_name\n two: your_name\n three: third_name\n\nOutputs:\n identifier:\n Value: {Ref: the_nested}\n value:\n Value: {‘Fn::GetAtt’: [the_nested, the_str]}\n”
main_template_change_prop = “\nHeatTemplateFormatVersion: ‘2012-12-12’\nResources:\n the_nested:\n Type: the.yaml\n Properties:\n one: updated_name\n two: your_name\n\nOutputs:\n identifier:\n Value: {Ref: the_nested}\n value:\n Value: {‘Fn::GetAtt’: [the_nested, the_str]}\n”
main_template_remove_prop = “\nHeatTemplateFormatVersion: ‘2012-12-12’\nResources:\n the_nested:\n Type: the.yaml\n Properties:\n one: my_name\n\nOutputs:\n identifier:\n Value: {Ref: the_nested}\n value:\n Value: {‘Fn::GetAtt’: [the_nested, the_str]}\n”
prop_add_tmpl = “\nHeatTemplateFormatVersion: ‘2012-12-12’\nParameters:\n one:\n Default: yikes\n Type: String\n two:\n Default: foo\n Type: String\n three:\n Default: bar\n Type: String\n\nResources:\n NestedResource:\n Type: OS::Heat::RandomString\n Properties:\n salt: {Ref: three}\nOutputs:\n the_str:\n Value: {‘Fn::GetAtt’: [NestedResource, value]}\n”
prop_change_tmpl = “\nHeatTemplateFormatVersion: ‘2012-12-12’\nParameters:\n one:\n Default: yikes\n Type: String\n two:\n Default: foo\n Type: String\nResources:\n NestedResource:\n Type: OS::Heat::RandomString\n Properties:\n salt: {Ref: two}\nOutputs:\n the_str:\n Value: {‘Fn::GetAtt’: [NestedResource, value]}\n”
prop_remove_tmpl = “\nHeatTemplateFormatVersion: ‘2012-12-12’\nParameters:\n one:\n Default: yikes\n Type: String\n\nResources:\n NestedResource:\n Type: OS::Heat::RandomString\n Properties:\n salt: {Ref: one}\nOutputs:\n the_str:\n Value: {‘Fn::GetAtt’: [NestedResource, value]}\n”
scenarios = [(‘no_changes’, {‘template’: “\nHeatTemplateFormatVersion: ‘2012-12-12’\nResources:\n the_nested:\n Type: the.yaml\n Properties:\n one: my_name\n two: your_name\nOutputs:\n identifier:\n Value: {Ref: the_nested}\n value:\n Value: {‘Fn::GetAtt’: [the_nested, the_str]}\n”, ‘expect’: ‘nochange’, ‘provider’: “\nHeatTemplateFormatVersion: ‘2012-12-12’\nParameters:\n one:\n Default: foo\n Type: String\n two:\n Default: bar\n Type: String\n\nResources:\n NestedResource:\n Type: OS::Heat::RandomString\n Properties:\n salt: {Ref: one}\nOutputs:\n the_str:\n Value: {‘Fn::GetAtt’: [NestedResource, value]}\n”}), (‘main_tmpl_change’, {‘template’: “\nHeatTemplateFormatVersion: ‘2012-12-12’\nResources:\n the_nested:\n Type: the.yaml\n Properties:\n one: updated_name\n two: your_name\n\nOutputs:\n identifier:\n Value: {Ref: the_nested}\n value:\n Value: {‘Fn::GetAtt’: [the_nested, the_str]}\n”, ‘expect’: ‘update’, ‘provider’: “\nHeatTemplateFormatVersion: ‘2012-12-12’\nParameters:\n one:\n Default: foo\n Type: String\n two:\n Default: bar\n Type: String\n\nResources:\n NestedResource:\n Type: OS::Heat::RandomString\n Properties:\n salt: {Ref: one}\nOutputs:\n the_str:\n Value: {‘Fn::GetAtt’: [NestedResource, value]}\n”}), (‘provider_change’, {‘template’: “\nHeatTemplateFormatVersion: ‘2012-12-12’\nResources:\n the_nested:\n Type: the.yaml\n Properties:\n one: my_name\n two: your_name\nOutputs:\n identifier:\n Value: {Ref: the_nested}\n value:\n Value: {‘Fn::GetAtt’: [the_nested, the_str]}\n”, ‘expect’: ‘update’, ‘provider’: “\nHeatTemplateFormatVersion: ‘2012-12-12’\nParameters:\n one:\n Default: foo\n Type: String\n two:\n Default: bar\n Type: String\n\nResources:\n NestedResource:\n Type: OS::Heat::RandomString\n Properties:\n salt: yum\nOutputs:\n the_str:\n Value: {‘Fn::GetAtt’: [NestedResource, value]}\n”}), (‘provider_props_change’, {‘template’: “\nHeatTemplateFormatVersion: ‘2012-12-12’\nResources:\n the_nested:\n Type: the.yaml\n Properties:\n one: my_name\n two: your_name\nOutputs:\n identifier:\n Value: {Ref: the_nested}\n value:\n Value: {‘Fn::GetAtt’: [the_nested, the_str]}\n”, ‘expect’: ‘update’, ‘provider’: “\nHeatTemplateFormatVersion: ‘2012-12-12’\nParameters:\n one:\n Default: yikes\n Type: String\n two:\n Default: foo\n Type: String\nResources:\n NestedResource:\n Type: OS::Heat::RandomString\n Properties:\n salt: {Ref: two}\nOutputs:\n the_str:\n Value: {‘Fn::GetAtt’: [NestedResource, value]}\n”}), (‘provider_props_add’, {‘template’: “\nHeatTemplateFormatVersion: ‘2012-12-12’\nResources:\n the_nested:\n Type: the.yaml\n Properties:\n one: my_name\n two: your_name\n three: third_name\n\nOutputs:\n identifier:\n Value: {Ref: the_nested}\n value:\n Value: {‘Fn::GetAtt’: [the_nested, the_str]}\n”, ‘expect’: ‘update’, ‘provider’: “\nHeatTemplateFormatVersion: ‘2012-12-12’\nParameters:\n one:\n Default: yikes\n Type: String\n two:\n Default: foo\n Type: String\n three:\n Default: bar\n Type: String\n\nResources:\n NestedResource:\n Type: OS::Heat::RandomString\n Properties:\n salt: {Ref: three}\nOutputs:\n the_str:\n Value: {‘Fn::GetAtt’: [NestedResource, value]}\n”}), (‘provider_props_remove’, {‘template’: “\nHeatTemplateFormatVersion: ‘2012-12-12’\nResources:\n the_nested:\n Type: the.yaml\n Properties:\n one: my_name\n\nOutputs:\n identifier:\n Value: {Ref: the_nested}\n value:\n Value: {‘Fn::GetAtt’: [the_nested, the_str]}\n”, ‘expect’: ‘nochange’, ‘provider’: “\nHeatTemplateFormatVersion: ‘2012-12-12’\nParameters:\n one:\n Default: yikes\n Type: String\n\nResources:\n NestedResource:\n Type: OS::Heat::RandomString\n Properties:\n salt: {Ref: one}\nOutputs:\n the_str:\n Value: {‘Fn::GetAtt’: [NestedResource, value]}\n”}), (‘provider_attr_change’, {‘template’: “\nHeatTemplateFormatVersion: ‘2012-12-12’\nResources:\n the_nested:\n Type: the.yaml\n Properties:\n one: my_name\n two: your_name\nOutputs:\n identifier:\n Value: {Ref: the_nested}\n value:\n Value: {‘Fn::GetAtt’: [the_nested, the_str]}\n”, ‘expect’: ‘nochange’, ‘provider’: “\nHeatTemplateFormatVersion: ‘2012-12-12’\nParameters:\n one:\n Default: foo\n Type: String\n two:\n Default: bar\n Type: String\n\nResources:\n NestedResource:\n Type: OS::Heat::RandomString\n Properties:\n salt: {Ref: one}\nOutputs:\n the_str:\n Value: {‘Fn::GetAtt’: [NestedResource, value]}\n something_else:\n Value: just_a_string\n”})]
test_template_resource_update_template_schema()[source]
class heat_integrationtests.functional.test_template_resource.ValidateFacadeTest(*args, **kwargs)[source]

Bases: heat_integrationtests.functional.functional_base.FunctionalTestsBase

Prove that nested stack errors don’t suck.

env = ‘\nresource_registry:\n OS::Thingy: facade.yaml\n resources:\n thisone:\n OS::Thingy: concrete.yaml\n’
setUp()[source]
templ_facade = ‘\nheat_template_version: 2015-04-30\nparameters:\n one:\n type: string\n two:\n type: string\noutputs:\n here-it-is:\n value: noop\n’
template = ‘\nheat_template_version: 2015-10-15\nresources:\n thisone:\n type: OS::Thingy\n properties:\n one: pre\n two: post\noutputs:\n one:\n value: {get_attr: [thisone, here-it-is]}\n’
test_missing_output()[source]
test_missing_param()[source]