Replace KeyPair resource by TestResource

... because we don't really intend to test the actual resource logic
but behavior of the engine logic to manage resources.

Depends-on: https://review.opendev.org/851669
Story: 2010201
Task: 45918
Change-Id: If651dbe34792c8ec72320a6d389a1bc1f2d23d13
This commit is contained in:
Takashi Kajinami 2022-07-31 01:28:02 +09:00
parent bb97ed77ae
commit d361aec71b

View File

@ -15,7 +15,6 @@ import json
from heatclient import exc as heat_exceptions
import yaml
from heat_integrationtests.common import test
from heat_integrationtests.functional import functional_base
@ -517,14 +516,13 @@ class TemplateResourceUpdateFailedTest(functional_base.FunctionalTestsBase):
main_template = '''
HeatTemplateFormatVersion: '2012-12-12'
Resources:
keypair:
Type: OS::Nova::KeyPair
test:
Type: OS::Heat::TestResource
Properties:
name: replace-this
save_private_key: false
fail: replace-this
server:
Type: server_fail.yaml
DependsOn: keypair
DependsOn: test
'''
nested_templ = '''
HeatTemplateFormatVersion: '2012-12-12'
@ -535,21 +533,18 @@ Resources:
def setUp(self):
super(TemplateResourceUpdateFailedTest, self).setUp()
self.assign_keypair()
def test_update_on_failed_create(self):
# create a stack with "server" dependent on "keypair", but
# keypair fails, so "server" is not created properly.
# create a stack with "server" dependent on "test", but
# "test" fails, so "server" is not created properly.
# We then fix the template and it should succeed.
broken_templ = self.main_template.replace('replace-this',
self.keypair_name)
broken_templ = self.main_template.replace('replace-this', 'true')
stack_identifier = self.stack_create(
template=broken_templ,
files={'server_fail.yaml': self.nested_templ},
expected_status='CREATE_FAILED')
fixed_templ = self.main_template.replace('replace-this',
test.rand_name())
fixed_templ = self.main_template.replace('replace-this', 'false')
self.update_stack(stack_identifier,
fixed_templ,
files={'server_fail.yaml': self.nested_templ})