Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] [Data Usage] add error handling and tests for privilege related…
… errors (#203006) (#203252) # Backport This will backport the following commits from `main` to `8.x`: - [[Data Usage] add error handling and tests for privilege related errors (#203006)](#203006) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Sandra G","email":"neptunian@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-12-06T15:58:20Z","message":"[Data Usage] add error handling and tests for privilege related errors (#203006)\n\n- handling of 2 error cases to error handler\r\n- `security_exception` due to lack of privileges. Metering api will\r\nrespond when one of the following isn't available as a user privilege\r\n`monitor,view_index_metadata,manage,all`.\r\n- `index_not_found_exception`. Metering api will respond with this when\r\nno indices exist for the privileges it has access to or when no indices\r\nare found.\r\n- api integration tests for data_streams route for the following cases\r\n- returns no data streams when there are none it has access to and\r\nresponds with appropriate message\r\n- returns no data streams without necessary privileges and responds with\r\nappropriate message\r\n- returns data streams when user only has access to a subset of indices\r\nwith necessary privileges\r\n- functional tests for same as above. these remain skipped due to not\r\nbeing able to create data streams picked up by metering api since we\r\nimplemented filtering out zero storage size data streams, but useful for\r\nlocal testing with some code changes.\r\n\r\n\r\n### `security_exception` view\r\n<img width=\"1555\" alt=\"Screenshot 2024-12-04 at 1 14 10 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/241a2eb8-1c77-4592-ba18-b971512e712e\">\r\n\r\n### `index_not_found_exception` view\r\n<img width=\"1589\" alt=\"Screenshot 2024-12-04 at 1 13 13 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/12b68d66-9178-4957-b014-5765be348694\">\r\n\r\n---------\r\n\r\nCo-authored-by: Ashokaditya <ashokaditya@elastic.co>\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"42348d41f43a2e69c93b0e7a6b2f372bc96fd059","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","ci:build-serverless-image"],"title":"[Data Usage] add error handling and tests for privilege related errors","number":203006,"url":"https://github.com/elastic/kibana/pull/203006","mergeCommit":{"message":"[Data Usage] add error handling and tests for privilege related errors (#203006)\n\n- handling of 2 error cases to error handler\r\n- `security_exception` due to lack of privileges. Metering api will\r\nrespond when one of the following isn't available as a user privilege\r\n`monitor,view_index_metadata,manage,all`.\r\n- `index_not_found_exception`. Metering api will respond with this when\r\nno indices exist for the privileges it has access to or when no indices\r\nare found.\r\n- api integration tests for data_streams route for the following cases\r\n- returns no data streams when there are none it has access to and\r\nresponds with appropriate message\r\n- returns no data streams without necessary privileges and responds with\r\nappropriate message\r\n- returns data streams when user only has access to a subset of indices\r\nwith necessary privileges\r\n- functional tests for same as above. these remain skipped due to not\r\nbeing able to create data streams picked up by metering api since we\r\nimplemented filtering out zero storage size data streams, but useful for\r\nlocal testing with some code changes.\r\n\r\n\r\n### `security_exception` view\r\n<img width=\"1555\" alt=\"Screenshot 2024-12-04 at 1 14 10 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/241a2eb8-1c77-4592-ba18-b971512e712e\">\r\n\r\n### `index_not_found_exception` view\r\n<img width=\"1589\" alt=\"Screenshot 2024-12-04 at 1 13 13 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/12b68d66-9178-4957-b014-5765be348694\">\r\n\r\n---------\r\n\r\nCo-authored-by: Ashokaditya <ashokaditya@elastic.co>\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"42348d41f43a2e69c93b0e7a6b2f372bc96fd059"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/203006","number":203006,"mergeCommit":{"message":"[Data Usage] add error handling and tests for privilege related errors (#203006)\n\n- handling of 2 error cases to error handler\r\n- `security_exception` due to lack of privileges. Metering api will\r\nrespond when one of the following isn't available as a user privilege\r\n`monitor,view_index_metadata,manage,all`.\r\n- `index_not_found_exception`. Metering api will respond with this when\r\nno indices exist for the privileges it has access to or when no indices\r\nare found.\r\n- api integration tests for data_streams route for the following cases\r\n- returns no data streams when there are none it has access to and\r\nresponds with appropriate message\r\n- returns no data streams without necessary privileges and responds with\r\nappropriate message\r\n- returns data streams when user only has access to a subset of indices\r\nwith necessary privileges\r\n- functional tests for same as above. these remain skipped due to not\r\nbeing able to create data streams picked up by metering api since we\r\nimplemented filtering out zero storage size data streams, but useful for\r\nlocal testing with some code changes.\r\n\r\n\r\n### `security_exception` view\r\n<img width=\"1555\" alt=\"Screenshot 2024-12-04 at 1 14 10 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/241a2eb8-1c77-4592-ba18-b971512e712e\">\r\n\r\n### `index_not_found_exception` view\r\n<img width=\"1589\" alt=\"Screenshot 2024-12-04 at 1 13 13 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/12b68d66-9178-4957-b014-5765be348694\">\r\n\r\n---------\r\n\r\nCo-authored-by: Ashokaditya <ashokaditya@elastic.co>\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"42348d41f43a2e69c93b0e7a6b2f372bc96fd059"}}]}] BACKPORT--> Co-authored-by: Sandra G <neptunian@users.noreply.github.com>
- Loading branch information