kibana/x-pack/test/monitoring_api_integration/apis
Cristina Amico 966736e4b4
[Fleet] Add rate limiting to install by upload endpoint (#184036)
Fixes https://github.com/elastic/ingest-dev/issues/3217

## Summary

Add rate limiting to "install by upload" endpoint. 
Implemented with a cache that is set with the timestamp of each install
by upload, independently from the package name/version. If the time
elapsed since the last timestamp it's less than retry time (10s), the
endpoint will return `429 Too many requests`.

### Testing
- Upload a package with 
```
curl -XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true' http://localhost:5601/YOUR_PATH/api/fleet/epm/packages -u elastic:changeme --data-binary @PACKAGE_NAME.zip
```
- Upload another package shortly after. It can be the same one or
another one, as the rate limiting is applied across all uploads, no
matter the package name.
- If the second upload happens <10s after the first one, should return
error `429 Too Many Requests. Please wait 10s before uploading again.`

### Checklist

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-06-06 17:13:52 +02:00
..
apm skip flaky suite (#177142) 2024-05-01 14:41:15 +01:00
beats skip failing test suite (#182783) 2024-05-23 12:06:52 -04:00
elasticsearch skip flaky suite (#184619) 2024-06-05 16:06:18 +01:00
enterprisesearch [Stack Monitoring] install packages before test suite runs (#165881) 2023-09-08 13:32:30 +02:00
kibana [Fleet] Add rate limiting to install by upload endpoint (#184036) 2024-06-06 17:13:52 +02:00
logstash [Stack Monitoring] install packages before test suite runs (#165881) 2023-09-08 13:32:30 +02:00
index.ts