Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GET SM policies return empty list when ism config index does not exist #1072

Merged
merged 5 commits into from
Jan 24, 2024

Conversation

aggarwalShivani
Copy link
Contributor

Fix for GET request on SM policies to return empty list when ism config index does not exist

Issue #, if available: #1055

Description of changes:
When a GET request is issued to snapshot mananagement API endpoint, to list all available sm policies, it throws an IndexNotFound exception if the ism config index is not yet created. (Note - This index gets created only after atleast one ism/sm policy gets created).
To align the behaviour to ism policies endpoint (that responds with an empty list for missing config index cases), the change is done here for SM policies.
In success case, searchResponse is returned like done before.
In the failure case (for missing config index), instead of throwing OpenSearchStatusException, an empty list of 0 Length is returned from the getAllPolicies function.
If any other exception is caught, then that exception is thrown as-is.

CheckList:

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…ig index does not exist

Signed-off-by: aggarwalShivani <[email protected]>
Copy link

codecov bot commented Jan 19, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (6270b2c) 74.86% compared to head (7a63a9d) 74.90%.

Files Patch % Lines
.../api/transport/get/TransportGetSMPoliciesAction.kt 50.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1072      +/-   ##
============================================
+ Coverage     74.86%   74.90%   +0.04%     
- Complexity     2808     2814       +6     
============================================
  Files           367      367              
  Lines         16518    16522       +4     
  Branches       2362     2363       +1     
============================================
+ Hits          12366    12376      +10     
+ Misses         2853     2843      -10     
- Partials       1299     1303       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Hailong-am
Copy link
Collaborator

@bowenlan-amzn would like to confirm with you, return empty list meet your expectation as well

@bowenlan-amzn
Copy link
Member

@Hailong-am Yes, this is the behavior of ISM. Though rollup and transform doesn't catch IndexNotFoundException

@aggarwalShivani
Copy link
Contributor Author

Hi reviewers,
Thanks for the feedback so far.
I'm facing difficulty in understanding some failures in checks running on the github CI for my PR. Its my first PR to this project and would highly appreciate any pointers and guidance.
4 out of 30 checks have failed. I've put some details below -

i. Docker Security Test Workflow

WARNING: Please consider reporting this to the maintainers of org.opensearch.bootstrap.Security
uncaught exception in thread [main]
java.lang.IllegalStateException: failed to load plugin class [org.opensearch.security.OpenSearchSecurityPlugin]
Likely root cause: OpenSearchException[plugins.security.ssl.transport.keystore_filepath or plugins.security.ssl.transport.server.pemcert_filepath and plugins.security.ssl.transport.client.pemcert_filepath must be set if transport ssl is requested.]

Analysis - This looks like an issue with security plugin, unrelated to the changes made in this PR. Any thoughts on this?

ii. In both these cases, Test and Build Workflow / test-and-build-linux (21, ism) and Test and Build Workflow / test-and-build-linux (21, non-ism), all failures have the same exception ->

   Caused by:
        java.net.SocketTimeoutException: 60000 MILLISECONDS
java.lang.AssertionError: Fri Jan 19 15:23:33 ART 2024: There are still tasks running after this test that might break subsequent tests:

I have run some of these testcases individually on my local setup, and they passed. Any pointers on the root cause here? Are they expected?

iii. codecov/patch failed with warning - Added lines #L78 - L79 were not covered by tests.
But the test-case added, does cover the mentioned case. I'll perhaps recheck this after changes get finalized for TransportGetSMPoliciesAction.kt

@Hailong-am
Copy link
Collaborator

Hailong-am commented Jan 23, 2024

ii. In both these cases, Test and Build Workflow / test-and-build-linux (21, ism) and Test and Build Workflow / test-and-build-linux (21, non-ism), all failures have the same exception ->

we can ignore jdk 21 failure, it's known issue. Reference opensearch-project/flow-framework#426

Docker Security Test Workflow

Related to #1064, will have another PR #1076 to handle it.

@bowenlan-amzn bowenlan-amzn changed the title Fix for GET request on SM policies to return empty list when ism config index does not exist GET SM policies return empty list when ism config index does not exist Jan 24, 2024
@bowenlan-amzn bowenlan-amzn merged commit 67292ca into opensearch-project:main Jan 24, 2024
30 of 32 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 24, 2024
#1072)

(cherry picked from commit 67292ca)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@aggarwalShivani
Copy link
Contributor Author

Thanks @Hailong-am and @bowenlan-amzn for the inputs and help here :)

Hailong-am pushed a commit that referenced this pull request Jan 25, 2024
#1072) (#1078)

(cherry picked from commit 67292ca)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: bowenlan-amzn <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants