Full response for Orchestration client methods
Provide the entire response object for all methods of the OrchestrationClient partially implements: blueprint method-return-value-and-move-service-clients-to-lib Change-Id: I6db8f17335a2dfb9baaa61cfd22353d5e4fc538a
This commit is contained in:
parent
c29370c518
commit
ab6c3a3843
|
@ -163,7 +163,7 @@ class BaseOrchestrationTest(tempest.test.BaseTestCase):
|
|||
|
||||
def list_resources(self, stack_identifier):
|
||||
"""Get a dict mapping of resource names to types."""
|
||||
resources = self.client.list_resources(stack_identifier)
|
||||
resources = self.client.list_resources(stack_identifier)['resources']
|
||||
self.assertIsInstance(resources, list)
|
||||
for res in resources:
|
||||
self.assert_fields_in_dict(res, 'logical_resource_id',
|
||||
|
@ -174,5 +174,5 @@ class BaseOrchestrationTest(tempest.test.BaseTestCase):
|
|||
for r in resources)
|
||||
|
||||
def get_stack_output(self, stack_identifier, output_key):
|
||||
body = self.client.show_stack(stack_identifier)
|
||||
body = self.client.show_stack(stack_identifier)['stack']
|
||||
return self.stack_output(body, output_key)
|
||||
|
|
|
@ -75,7 +75,8 @@ class NeutronResourcesTestJSON(base.BaseOrchestrationTest):
|
|||
cls.stack_id = cls.stack_identifier.split('/')[1]
|
||||
try:
|
||||
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
|
||||
resources = cls.client.list_resources(cls.stack_identifier)
|
||||
resources = (cls.client.list_resources(cls.stack_identifier)
|
||||
['resources'])
|
||||
except exceptions.TimeoutException as e:
|
||||
if CONF.compute_feature_enabled.console_output:
|
||||
# attempt to log the server console to help with debugging
|
||||
|
|
|
@ -47,7 +47,7 @@ class StacksTestJSON(base.BaseOrchestrationTest):
|
|||
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
|
||||
|
||||
def _list_stacks(self, expected_num=None, **filter_kwargs):
|
||||
stacks = self.client.list_stacks(params=filter_kwargs)
|
||||
stacks = self.client.list_stacks(params=filter_kwargs)['stacks']
|
||||
self.assertIsInstance(stacks, list)
|
||||
if expected_num is not None:
|
||||
self.assertEqual(expected_num, len(stacks))
|
||||
|
@ -63,7 +63,7 @@ class StacksTestJSON(base.BaseOrchestrationTest):
|
|||
@test.idempotent_id('992f96e3-41ee-4ff6-91c7-bcfb670c0919')
|
||||
def test_stack_show(self):
|
||||
"""Getting details about created stack should be possible."""
|
||||
stack = self.client.show_stack(self.stack_name)
|
||||
stack = self.client.show_stack(self.stack_name)['stack']
|
||||
self.assertIsInstance(stack, dict)
|
||||
self.assert_fields_in_dict(stack, 'stack_name', 'id', 'links',
|
||||
'parameters', 'outputs', 'disable_rollback',
|
||||
|
@ -100,7 +100,7 @@ class StacksTestJSON(base.BaseOrchestrationTest):
|
|||
def test_show_resource(self):
|
||||
"""Getting details about created resource should be possible."""
|
||||
resource = self.client.show_resource(self.stack_identifier,
|
||||
self.resource_name)
|
||||
self.resource_name)['resource']
|
||||
self.assertIsInstance(resource, dict)
|
||||
self.assert_fields_in_dict(resource, 'resource_name', 'description',
|
||||
'links', 'logical_resource_id',
|
||||
|
@ -115,14 +115,14 @@ class StacksTestJSON(base.BaseOrchestrationTest):
|
|||
"""Getting metadata for created resources should be possible."""
|
||||
metadata = self.client.show_resource_metadata(
|
||||
self.stack_identifier,
|
||||
self.resource_name)
|
||||
self.resource_name)['metadata']
|
||||
self.assertIsInstance(metadata, dict)
|
||||
self.assertEqual(['Tom', 'Stinky'], metadata.get('kittens', None))
|
||||
|
||||
@test.idempotent_id('46567533-0a7f-483b-8942-fa19e0f17839')
|
||||
def test_list_events(self):
|
||||
"""Getting list of created events for the stack should be possible."""
|
||||
events = self.client.list_events(self.stack_identifier)
|
||||
events = self.client.list_events(self.stack_identifier)['events']
|
||||
self.assertIsInstance(events, list)
|
||||
|
||||
for event in events:
|
||||
|
@ -138,12 +138,12 @@ class StacksTestJSON(base.BaseOrchestrationTest):
|
|||
def test_show_event(self):
|
||||
"""Getting details about an event should be possible."""
|
||||
events = self.client.list_resource_events(self.stack_identifier,
|
||||
self.resource_name)
|
||||
self.resource_name)['events']
|
||||
self.assertNotEqual([], events)
|
||||
events.sort(key=lambda event: event['event_time'])
|
||||
event_id = events[0]['id']
|
||||
event = self.client.show_event(self.stack_identifier,
|
||||
self.resource_name, event_id)
|
||||
self.resource_name, event_id)['event']
|
||||
self.assertIsInstance(event, dict)
|
||||
self.assert_fields_in_dict(event, 'resource_name', 'event_time',
|
||||
'links', 'logical_resource_id',
|
||||
|
|
|
@ -43,7 +43,8 @@ class NovaKeyPairResourcesYAMLTest(base.BaseOrchestrationTest):
|
|||
|
||||
cls.stack_id = cls.stack_identifier.split('/')[1]
|
||||
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
|
||||
resources = cls.client.list_resources(cls.stack_identifier)
|
||||
resources = (cls.client.list_resources(cls.stack_identifier)
|
||||
['resources'])
|
||||
cls.test_resources = {}
|
||||
for resource in resources:
|
||||
cls.test_resources[resource['logical_resource_id']] = resource
|
||||
|
@ -70,7 +71,7 @@ class NovaKeyPairResourcesYAMLTest(base.BaseOrchestrationTest):
|
|||
|
||||
@test.idempotent_id('8d77dec7-91fd-45a6-943d-5abd45e338a4')
|
||||
def test_stack_keypairs_output(self):
|
||||
stack = self.client.show_stack(self.stack_name)
|
||||
stack = self.client.show_stack(self.stack_name)['stack']
|
||||
self.assertIsInstance(stack, dict)
|
||||
|
||||
output_map = {}
|
||||
|
|
|
@ -20,7 +20,7 @@ class ResourceTypesTest(base.BaseOrchestrationTest):
|
|||
@test.idempotent_id('7123d082-3577-4a30-8f00-f805327c4ffd')
|
||||
def test_resource_type_list(self):
|
||||
"""Verify it is possible to list resource types."""
|
||||
resource_types = self.client.list_resource_types()
|
||||
resource_types = self.client.list_resource_types()['resource_types']
|
||||
self.assertIsInstance(resource_types, list)
|
||||
self.assertIn('OS::Nova::Server', resource_types)
|
||||
|
||||
|
@ -28,7 +28,7 @@ class ResourceTypesTest(base.BaseOrchestrationTest):
|
|||
@test.idempotent_id('0e85a483-828b-4a28-a0e3-f0a21809192b')
|
||||
def test_resource_type_show(self):
|
||||
"""Verify it is possible to get schema about resource types."""
|
||||
resource_types = self.client.list_resource_types()
|
||||
resource_types = self.client.list_resource_types()['resource_types']
|
||||
self.assertNotEmpty(resource_types)
|
||||
|
||||
for resource_type in resource_types:
|
||||
|
|
|
@ -30,7 +30,7 @@ class StacksTestJSON(base.BaseOrchestrationTest):
|
|||
@test.attr(type='smoke')
|
||||
@test.idempotent_id('d35d628c-07f6-4674-85a1-74db9919e986')
|
||||
def test_stack_list_responds(self):
|
||||
stacks = self.client.list_stacks()
|
||||
stacks = self.client.list_stacks()['stacks']
|
||||
self.assertIsInstance(stacks, list)
|
||||
|
||||
@test.attr(type='smoke')
|
||||
|
@ -47,20 +47,20 @@ class StacksTestJSON(base.BaseOrchestrationTest):
|
|||
self.client.wait_for_stack_status(stack_identifier, 'CREATE_COMPLETE')
|
||||
|
||||
# check for stack in list
|
||||
stacks = self.client.list_stacks()
|
||||
stacks = self.client.list_stacks()['stacks']
|
||||
list_ids = list([stack['id'] for stack in stacks])
|
||||
self.assertIn(stack_id, list_ids)
|
||||
|
||||
# fetch the stack
|
||||
stack = self.client.show_stack(stack_identifier)
|
||||
stack = self.client.show_stack(stack_identifier)['stack']
|
||||
self.assertEqual('CREATE_COMPLETE', stack['stack_status'])
|
||||
|
||||
# fetch the stack by name
|
||||
stack = self.client.show_stack(stack_name)
|
||||
stack = self.client.show_stack(stack_name)['stack']
|
||||
self.assertEqual('CREATE_COMPLETE', stack['stack_status'])
|
||||
|
||||
# fetch the stack by id
|
||||
stack = self.client.show_stack(stack_id)
|
||||
stack = self.client.show_stack(stack_id)['stack']
|
||||
self.assertEqual('CREATE_COMPLETE', stack['stack_status'])
|
||||
|
||||
# delete the stack
|
||||
|
|
|
@ -55,7 +55,8 @@ class SwiftResourcesTestJSON(base.BaseOrchestrationTest):
|
|||
cls.stack_id = cls.stack_identifier.split('/')[1]
|
||||
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
|
||||
cls.test_resources = {}
|
||||
resources = cls.client.list_resources(cls.stack_identifier)
|
||||
resources = (cls.client.list_resources(cls.stack_identifier)
|
||||
['resources'])
|
||||
for resource in resources:
|
||||
cls.test_resources[resource['logical_resource_id']] = resource
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ class StackService(BaseService):
|
|||
|
||||
def list(self):
|
||||
client = self.client
|
||||
stacks = client.list_stacks()
|
||||
stacks = client.list_stacks()['stacks']
|
||||
LOG.debug("List count, %s Stacks" % len(stacks))
|
||||
return stacks
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class OrchestrationClient(service_client.ServiceClient):
|
|||
resp, body = self.get(uri)
|
||||
self.expected_success(200, resp.status)
|
||||
body = json.loads(body)
|
||||
return service_client.ResponseBodyList(resp, body['stacks'])
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def create_stack(self, name, disable_rollback=True, parameters=None,
|
||||
timeout_mins=60, template=None, template_url=None,
|
||||
|
@ -111,7 +111,7 @@ class OrchestrationClient(service_client.ServiceClient):
|
|||
resp, body = self.get(url)
|
||||
self.expected_success(200, resp.status)
|
||||
body = json.loads(body)
|
||||
return service_client.ResponseBody(resp, body['stack'])
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def suspend_stack(self, stack_identifier):
|
||||
"""Suspend a stack."""
|
||||
|
@ -135,7 +135,7 @@ class OrchestrationClient(service_client.ServiceClient):
|
|||
resp, body = self.get(url)
|
||||
self.expected_success(200, resp.status)
|
||||
body = json.loads(body)
|
||||
return service_client.ResponseBodyList(resp, body['resources'])
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def show_resource(self, stack_identifier, resource_name):
|
||||
"""Returns the details of a single resource."""
|
||||
|
@ -143,7 +143,7 @@ class OrchestrationClient(service_client.ServiceClient):
|
|||
resp, body = self.get(url)
|
||||
self.expected_success(200, resp.status)
|
||||
body = json.loads(body)
|
||||
return service_client.ResponseBody(resp, body['resource'])
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def delete_stack(self, stack_identifier):
|
||||
"""Deletes the specified Stack."""
|
||||
|
@ -160,7 +160,7 @@ class OrchestrationClient(service_client.ServiceClient):
|
|||
while True:
|
||||
try:
|
||||
body = self.show_resource(
|
||||
stack_identifier, resource_name)
|
||||
stack_identifier, resource_name)['resource']
|
||||
except lib_exc.NotFound:
|
||||
# ignore this, as the resource may not have
|
||||
# been created yet
|
||||
|
@ -195,7 +195,7 @@ class OrchestrationClient(service_client.ServiceClient):
|
|||
|
||||
while True:
|
||||
try:
|
||||
body = self.show_stack(stack_identifier)
|
||||
body = self.show_stack(stack_identifier)['stack']
|
||||
except lib_exc.NotFound:
|
||||
if status == 'DELETE_COMPLETE':
|
||||
return
|
||||
|
@ -224,7 +224,7 @@ class OrchestrationClient(service_client.ServiceClient):
|
|||
resp, body = self.get(url)
|
||||
self.expected_success(200, resp.status)
|
||||
body = json.loads(body)
|
||||
return service_client.ResponseBody(resp, body['metadata'])
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def list_events(self, stack_identifier):
|
||||
"""Returns list of all events for a stack."""
|
||||
|
@ -232,7 +232,7 @@ class OrchestrationClient(service_client.ServiceClient):
|
|||
resp, body = self.get(url)
|
||||
self.expected_success(200, resp.status)
|
||||
body = json.loads(body)
|
||||
return service_client.ResponseBodyList(resp, body['events'])
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def list_resource_events(self, stack_identifier, resource_name):
|
||||
"""Returns list of all events for a resource from stack."""
|
||||
|
@ -241,7 +241,7 @@ class OrchestrationClient(service_client.ServiceClient):
|
|||
resp, body = self.get(url)
|
||||
self.expected_success(200, resp.status)
|
||||
body = json.loads(body)
|
||||
return service_client.ResponseBodyList(resp, body['events'])
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def show_event(self, stack_identifier, resource_name, event_id):
|
||||
"""Returns the details of a single stack's event."""
|
||||
|
@ -250,7 +250,7 @@ class OrchestrationClient(service_client.ServiceClient):
|
|||
resp, body = self.get(url)
|
||||
self.expected_success(200, resp.status)
|
||||
body = json.loads(body)
|
||||
return service_client.ResponseBody(resp, body['event'])
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def show_template(self, stack_identifier):
|
||||
"""Returns the template for the stack."""
|
||||
|
@ -293,7 +293,7 @@ class OrchestrationClient(service_client.ServiceClient):
|
|||
resp, body = self.get('resource_types')
|
||||
self.expected_success(200, resp.status)
|
||||
body = json.loads(body)
|
||||
return service_client.ResponseBodyList(resp, body['resource_types'])
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def show_resource_type(self, resource_type_name):
|
||||
"""Return the schema of a resource type."""
|
||||
|
|
Loading…
Reference in New Issue