[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 <elasticmachine@users.noreply.github.com>
Co-authored-by: Maxim Palenov <maxim.palenov@elastic.co>
Co-authored-by: dkirchan <55240027+dkirchan@users.noreply.github.com>
Co-authored-by: Gloria Hornero <gloria.hornero@elastic.co>
This commit is contained in:
Jesse Sant 2025-02-12 08:33:53 -08:00 committed by GitHub
parent 7a72b14fd5
commit 62977e7069
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);
}
});