-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Support extension additional settings with extension REST initialization #8414
Support extension additional settings with extension REST initialization #8414
Conversation
Signed-off-by: Craig Perkins <cwperx@amazon.com>
@owaiskazi19 This PR shows the REST Extension initialization working with settings defined from a plugin like the security plugin. |
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Codecov Report
@@ Coverage Diff @@
## main #8414 +/- ##
============================================
+ Coverage 70.81% 70.89% +0.07%
- Complexity 56830 56911 +81
============================================
Files 4757 4757
Lines 269136 269130 -6
Branches 39403 39392 -11
============================================
+ Hits 190585 190789 +204
+ Misses 62445 62241 -204
+ Partials 16106 16100 -6
|
I was able to successfully setup tests using Mockito to partially mock the extensions manager. |
server/src/main/java/org/opensearch/extensions/rest/RestInitializeExtensionAction.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/extensions/rest/RestInitializeExtensionAction.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/opensearch/extensions/rest/RestInitializeExtensionActionTests.java
Outdated
Show resolved
Hide resolved
Gradle Check (Jenkins) Run Completed with:
|
server/src/main/java/org/opensearch/extensions/rest/RestInitializeExtensionAction.java
Show resolved
Hide resolved
Signed-off-by: Craig Perkins <cwperx@amazon.com>
server/src/main/java/org/opensearch/extensions/rest/RestInitializeExtensionAction.java
Show resolved
Hide resolved
server/src/test/java/org/opensearch/extensions/rest/RestInitializeExtensionActionTests.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Craig Perkins <cwperx@amazon.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM! @dbwiddis need another pair of eyes
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-8414-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 a0299fceda9900f8bfdbf8b0229ad1e8884a4fd4
# Push it to GitHub
git push --set-upstream origin backport/backport-8414-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-2.x Then, create a pull request where the |
@cwperks looks like this one needs a manual backport to 2.x. |
…ion (opensearch-project#8414) * Support extension additional settings with extension REST initialization Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add CHANGELOG entry Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add tests Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add addition setting types to test Signed-off-by: Craig Perkins <cwperx@amazon.com> * Address code review feedback Signed-off-by: Craig Perkins <cwperx@amazon.com> * Check for missing values Signed-off-by: Craig Perkins <cwperx@amazon.com> * Use Version.CURRENT Signed-off-by: Craig Perkins <cwperx@amazon.com> * Switch minimum compat version back to 3.0.0 Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove hardcoded versions Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Craig Perkins <cwperx@amazon.com> (cherry picked from commit a0299fc)
@owaiskazi19 Manual backport created: #8445 |
…EST initialization (#8445) * Support extension additional settings with extension REST initialization (#8414) * Support extension additional settings with extension REST initialization Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add CHANGELOG entry Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add tests Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add addition setting types to test Signed-off-by: Craig Perkins <cwperx@amazon.com> * Address code review feedback Signed-off-by: Craig Perkins <cwperx@amazon.com> * Check for missing values Signed-off-by: Craig Perkins <cwperx@amazon.com> * Use Version.CURRENT Signed-off-by: Craig Perkins <cwperx@amazon.com> * Switch minimum compat version back to 3.0.0 Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove hardcoded versions Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Craig Perkins <cwperx@amazon.com> (cherry picked from commit a0299fc) * Update Strings import Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Craig Perkins <cwperx@amazon.com>
…ion (opensearch-project#8414) * Support extension additional settings with extension REST initialization Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add CHANGELOG entry Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add tests Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add addition setting types to test Signed-off-by: Craig Perkins <cwperx@amazon.com> * Address code review feedback Signed-off-by: Craig Perkins <cwperx@amazon.com> * Check for missing values Signed-off-by: Craig Perkins <cwperx@amazon.com> * Use Version.CURRENT Signed-off-by: Craig Perkins <cwperx@amazon.com> * Switch minimum compat version back to 3.0.0 Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove hardcoded versions Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Craig Perkins <cwperx@amazon.com> Signed-off-by: sahil buddharaju <sahilbud@amazon.com>
…ion (opensearch-project#8414) * Support extension additional settings with extension REST initialization Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add CHANGELOG entry Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add tests Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add addition setting types to test Signed-off-by: Craig Perkins <cwperx@amazon.com> * Address code review feedback Signed-off-by: Craig Perkins <cwperx@amazon.com> * Check for missing values Signed-off-by: Craig Perkins <cwperx@amazon.com> * Use Version.CURRENT Signed-off-by: Craig Perkins <cwperx@amazon.com> * Switch minimum compat version back to 3.0.0 Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove hardcoded versions Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Craig Perkins <cwperx@amazon.com>
…ion (opensearch-project#8414) * Support extension additional settings with extension REST initialization Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add CHANGELOG entry Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add tests Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add addition setting types to test Signed-off-by: Craig Perkins <cwperx@amazon.com> * Address code review feedback Signed-off-by: Craig Perkins <cwperx@amazon.com> * Check for missing values Signed-off-by: Craig Perkins <cwperx@amazon.com> * Use Version.CURRENT Signed-off-by: Craig Perkins <cwperx@amazon.com> * Switch minimum compat version back to 3.0.0 Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove hardcoded versions Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Craig Perkins <cwperx@amazon.com> Signed-off-by: Shivansh Arora <hishiv@amazon.com>
Description
This PR modifies the
RestInitializeExtensionAction
to extract any additional settings supplied from ExtensionAwarePlugin.getExtensionSettings <- utilized by the security plugin to define security settings for extensions.I tested this change by running an extension locally and defining settings from the Security plugin and calling on the API to initialize an extension. I plan to test different types of settings, booleans, strings, arrays, etc to verify this works with different types of settings.
I was not able to modify the test to show this working from a test case, but plan to add an automated test ASAP.This PR uses Mockito to partially mock ExtensionsManager to show how additional settings work with the REST endpoint for extension initialization.Related Issues
Resolves #8032
Check List
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.