From 62977e7069498d719c5cf9da4482fc8e2684a80f Mon Sep 17 00:00:00 2001 From: Jesse Sant <56378862+jesse-sant@users.noreply.github.com> Date: Wed, 12 Feb 2025 08:33:53 -0800 Subject: [PATCH] [Security Solution] Cypress: Also cleanup proxy handler projects (#192213) ## Summary Based on a request in [this issue](https://github.com/elastic/security-team/issues/10341). The Cypress cleanup task for serverless testing didn't include a command to cleanup the project tested against when that project was created using the proxy handler. This PR adds a second conditional method in the cleanup task to cleanup projects with the proxy handler when it is in use. ### Checklist - [ ] Cypress tests run with proxy handler - [x] Projects created during a cypress run with the proxy handler are automatically cleaned up by the cypress cleanup task ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: Elastic Machine Co-authored-by: Maxim Palenov Co-authored-by: dkirchan <55240027+dkirchan@users.noreply.github.com> Co-authored-by: Gloria Hornero --- .../scripts/run_cypress/parallel_serverless.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/x-pack/solutions/security/plugins/security_solution/scripts/run_cypress/parallel_serverless.ts b/x-pack/solutions/security/plugins/security_solution/scripts/run_cypress/parallel_serverless.ts index 90ea733edd552..01fea487c79cc 100644 --- a/x-pack/solutions/security/plugins/security_solution/scripts/run_cypress/parallel_serverless.ts +++ b/x-pack/solutions/security/plugins/security_solution/scripts/run_cypress/parallel_serverless.ts @@ -489,6 +489,10 @@ ${JSON.stringify(cypressConfigFile, null, 2)} if (cloudHandler instanceof CloudHandler) { command = `curl -X DELETE ${BASE_ENV_URL}/api/v1/serverless/projects/security/${project.id} -H "Authorization: ApiKey ${API_KEY}"`; exec(command); + } else if (cloudHandler instanceof ProxyHandler) { + const proxyAuth = btoa(`${PROXY_CLIENT_ID}:${PROXY_SECRET}`); + command = `curl -X DELETE ${PROXY_URL}/projects/${project.id} -H "Authorization: Basic ${proxyAuth}"`; + exec(command); } });