Make ResourceTest tests stable

They were not stable because they may try to access resources from
a heat stack that could be in status CREATE_IN_PROGRESS
With this patch, the tests wait until their status is CREATE_COMPLETE

Change-Id: I51b36a3a6499d83db11abf43d64869b3dc85d24c
This commit is contained in:
Eduardo Olivares 2023-01-24 10:55:16 +01:00
parent 8cc77acc41
commit da23c16a59

View File

@ -144,6 +144,7 @@ class ResourceTest(testtools.TestCase):
router_stack = tobiko.required_fixture(stacks.RouterStackFixture) router_stack = tobiko.required_fixture(stacks.RouterStackFixture)
def test_find_resource(self): def test_find_resource(self):
self.router_stack.wait_for_create_complete()
resource = heat.list_resources(stack=self.router_stack).first resource = heat.list_resources(stack=self.router_stack).first
result = heat.find_resource( result = heat.find_resource(
stack=self.router_stack, stack=self.router_stack,
@ -153,6 +154,7 @@ class ResourceTest(testtools.TestCase):
result.physical_resource_id) result.physical_resource_id)
def test_list_resource(self): def test_list_resource(self):
self.router_stack.wait_for_create_complete()
resources = heat.list_resources(stack=self.router_stack) resources = heat.list_resources(stack=self.router_stack)
self.assertIsInstance(resources, tobiko.Selection) self.assertIsInstance(resources, tobiko.Selection)
self.assertNotEqual([], resources) self.assertNotEqual([], resources)