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