Merge "add delete accelerator request by instance uuid"

This commit is contained in:
Zuul 2022-06-29 07:26:16 +00:00 committed by Gerrit Code Review
commit a28d5d067d
2 changed files with 22 additions and 0 deletions

View File

@ -106,6 +106,11 @@ class CyborgRestClient(rest_client.RestClient):
resp, body = self.delete(url) resp, body = self.delete(url)
return self._response_helper(resp, body) return self._response_helper(resp, body)
def delete_accelerator_request_by_instance_uuid(self, instance_uuid):
url = self.AR_URL + "?instance=" + instance_uuid
resp, body = self.delete(url)
return self._response_helper(resp, body)
def get_deployable(self, deployable_uuid): def get_deployable(self, deployable_uuid):
resp, body = self.get("/deployables/%s" % deployable_uuid) resp, body = self.get("/deployables/%s" % deployable_uuid)
return self._response_helper(resp, body) return self._response_helper(resp, body)

View File

@ -83,6 +83,23 @@ class TestAcceleratorRequestController(base.BaseAPITest):
uuid_list = [it['uuid'] for it in response['arqs']] uuid_list = [it['uuid'] for it in response['arqs']]
self.assertNotIn(accelerator_request_uuid, uuid_list) self.assertNotIn(accelerator_request_uuid, uuid_list)
def test_delete_accelerator_request_by_instance_uuid(self):
# list accelerator request
response = self.os_admin.cyborg_client.list_accelerator_request()
instance_uuid_list = [it['instance_uuid'] for it in response['arqs']]
if instance_uuid_list:
# delete_accelerator_request
self.os_admin.cyborg_client.\
delete_accelerator_request_by_instance_uuid(
instance_uuid_list[0])
response = self.os_admin.cyborg_client.list_accelerator_request()
instance_uuid_list_again = [it['instance_uuid'] for
it in response['arqs']]
self.assertNotIn(instance_uuid_list[0], instance_uuid_list_again)
else:
raise self.skipException('not accelerator request with '
'instance uuid')
@classmethod @classmethod
def resource_cleanup(cls): def resource_cleanup(cls):
super(TestAcceleratorRequestController, cls).resource_cleanup() super(TestAcceleratorRequestController, cls).resource_cleanup()