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()