From 60d13bceb9c5944d752aa388ec42de5417bd35d2 Mon Sep 17 00:00:00 2001 From: zhaoqiuxia Date: Fri, 24 Jun 2022 14:10:11 +0800 Subject: [PATCH] add delete accelerator request by instance uuid delete accelerator request by instance uuid Change-Id: Ic486c57915f12c68ad343a7f874bbf07e356734e --- .../services/cyborg_rest_client.py | 5 +++++ .../tests/api/test_accelerator_request.py | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/cyborg_tempest_plugin/services/cyborg_rest_client.py b/cyborg_tempest_plugin/services/cyborg_rest_client.py index fb2e59e..d50842e 100644 --- a/cyborg_tempest_plugin/services/cyborg_rest_client.py +++ b/cyborg_tempest_plugin/services/cyborg_rest_client.py @@ -106,6 +106,11 @@ class CyborgRestClient(rest_client.RestClient): resp, body = self.delete(url) 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): resp, body = self.get("/deployables/%s" % deployable_uuid) return self._response_helper(resp, body) diff --git a/cyborg_tempest_plugin/tests/api/test_accelerator_request.py b/cyborg_tempest_plugin/tests/api/test_accelerator_request.py index 914f5f9..413fad2 100644 --- a/cyborg_tempest_plugin/tests/api/test_accelerator_request.py +++ b/cyborg_tempest_plugin/tests/api/test_accelerator_request.py @@ -83,6 +83,23 @@ class TestAcceleratorRequestController(base.BaseAPITest): uuid_list = [it['uuid'] for it in response['arqs']] 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 def resource_cleanup(cls): super(TestAcceleratorRequestController, cls).resource_cleanup()