Merge "Add heat stack action test case"

This commit is contained in:
Jenkins 2014-01-13 20:37:40 +00:00 committed by Gerrit Code Review
commit 377f2a11ab
2 changed files with 26 additions and 0 deletions

View File

@ -111,6 +111,18 @@ Outputs:
self.assertEqual(self.stack_id, stack['id'])
self.assertEqual('fluffy', stack['outputs'][0]['output_key'])
@attr(type='gate')
def test_suspend_resume_stack(self):
"""suspend and resume a stack."""
resp, suspend_stack = self.client.suspend_stack(self.stack_identifier)
self.assertEqual('200', resp['status'])
self.client.wait_for_stack_status(self.stack_identifier,
'SUSPEND_COMPLETE')
resp, resume_stack = self.client.resume_stack(self.stack_identifier)
self.assertEqual('200', resp['status'])
self.client.wait_for_stack_status(self.stack_identifier,
'RESUME_COMPLETE')
@attr(type='gate')
def test_list_resources(self):
"""Getting list of created resources for the stack should be possible.

View File

@ -102,6 +102,20 @@ class OrchestrationClient(rest_client.RestClient):
body = json.loads(body)
return resp, body['stack']
def suspend_stack(self, stack_identifier):
"""Suspend a stack."""
url = 'stacks/%s/actions' % stack_identifier
body = {'suspend': None}
resp, body = self.post(url, json.dumps(body), self.headers)
return resp, body
def resume_stack(self, stack_identifier):
"""Resume a stack."""
url = 'stacks/%s/actions' % stack_identifier
body = {'resume': None}
resp, body = self.post(url, json.dumps(body), self.headers)
return resp, body
def list_resources(self, stack_identifier):
"""Returns the details of a single resource."""
url = "stacks/%s/resources" % stack_identifier