Add test to validate multi _ heat stack_status

According to the Heat API docs, there is a status of IN_PROGRESS which
can cause the old code to fail. Add a test that sets that stack_status
so that we ensure we don't regress on splitting the stack_status.

Change-Id: Ibb1143ffd47465d1640f17bf4319425e6db1f4d1
This commit is contained in:
Monty Taylor 2017-03-31 11:58:00 -05:00
parent 97b9ac6beb
commit cf54ef6b92
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594

View File

@ -523,3 +523,33 @@ class TestStack(base.RequestsMockTestCase):
self.assertEqual('COMPLETE', res['status'])
self.assert_calls()
def test_get_stack_in_progress(self):
in_progress = self.stack.copy()
in_progress['stack_status'] = 'CREATE_IN_PROGRESS'
self.register_uris([
dict(method='GET',
uri='{endpoint}/stacks/{name}'.format(
endpoint=fakes.ORCHESTRATION_ENDPOINT,
name=self.stack_name),
status_code=302,
headers=dict(
location='{endpoint}/stacks/{name}/{id}'.format(
endpoint=fakes.ORCHESTRATION_ENDPOINT,
id=self.stack_id, name=self.stack_name))),
dict(method='GET',
uri='{endpoint}/stacks/{name}/{id}'.format(
endpoint=fakes.ORCHESTRATION_ENDPOINT,
id=self.stack_id, name=self.stack_name),
json={"stack": in_progress}),
])
res = self.cloud.get_stack(self.stack_name)
self.assertIsNotNone(res)
self.assertEqual(in_progress['stack_name'], res['stack_name'])
self.assertEqual(in_progress['stack_name'], res['name'])
self.assertEqual(in_progress['stack_status'], res['stack_status'])
self.assertEqual('CREATE', res['action'])
self.assertEqual('IN_PROGRESS', res['status'])
self.assert_calls()