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

Run Rest Integ Tests with the Security plugin installed #645

Merged
merged 18 commits into from
Jan 15, 2025

Conversation

cwperks
Copy link
Member

@cwperks cwperks commented Jun 27, 2024

Description

Opening up a Draft PR to start soliciting feedback. The goal of this PR is to run integ tests in this repo with the security plugin installed. This PR is a step towards being able to add tests for #347.

With the change in this PR you can run the sample-extension-plugin with security using ./gradlew :opensearch-job-scheduler-sample-extension:run -Dsecurity=true -Dhttps=true -Dtests.opensearch.username=admin -Dtests.opensearch.password=admin -x integTest

And run integTest with security like:

./gradlew :opensearch-job-scheduler-sample-extension:integTest -Dsecurity=true -Dhttps=true -Dtests.opensearch.username=admin -Dtests.opensearch.password=admin -Duser=admin -Dpassword=admin -Dtests.opensearch.secure=true -i --tests "*RestIT"

Example response to CAT plugins

> curl -XGET https://admin:admin@localhost:9200/_cat/plugins -k
integTest-0 opensearch-job-scheduler                  3.0.0.0-SNAPSHOT
integTest-0 opensearch-job-scheduler-sample-extension 3.0.0.0-SNAPSHOT
integTest-0 opensearch-security                       3.0.0.0-SNAPSHOT

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • 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.

@cwperks cwperks marked this pull request as ready for review August 23, 2024 13:47
@cwperks
Copy link
Member Author

cwperks commented Aug 23, 2024

@prudhvigodithi I switched this to ready for review to start soliciting feedback, but I am still working on a change to remove duplication between the SPI and the sample-extension-plugin which both perform integ tests and have some classes in common. I was able to create a separate sourceSet with common test classes, but had some trouble bundling the resources like the certificates.

Copy link

codecov bot commented Oct 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 37.67%. Comparing base (3f541ea) to head (55f4215).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #645   +/-   ##
=========================================
  Coverage     37.67%   37.67%           
  Complexity      135      135           
=========================================
  Files            22       22           
  Lines          1189     1189           
  Branches        109      109           
=========================================
  Hits            448      448           
  Misses          704      704           
  Partials         37       37           

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

@prudhvigodithi
Copy link
Member

Thanks @cwperks LGTM.

@cwperks
Copy link
Member Author

cwperks commented Jan 15, 2025

I just noticed that the new workflow is named BWC Test Workflow. I will create another CR to update the name to BWC Test Workflow to Integ tests with Security

@cwperks cwperks merged commit f1ad865 into opensearch-project:main Jan 15, 2025
15 of 16 checks passed
@opensearch-trigger-bot
Copy link

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/job-scheduler/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/job-scheduler/backport-2.x
# Create a new branch
git switch --create backport/backport-645-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 f1ad8650ceb5616ff85808307a4350f13b86e667
# Push it to GitHub
git push --set-upstream origin backport/backport-645-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/job-scheduler/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-645-to-2.x.

cwperks added a commit that referenced this pull request Jan 16, 2025
#645) (#712)

* Run Rest Integ Tests with the Security plugin installed (#645)

* Make .opendistro-job-scheduler-lock a System Index

Signed-off-by: Craig Perkins <[email protected]>

* Switch back to private

Signed-off-by: Craig Perkins <[email protected]>

* WIP on writing a CI check with security installed

Signed-off-by: Craig Perkins <[email protected]>

* Add CI Check to run Rest IntegTests with Security

Signed-off-by: Craig Perkins <[email protected]>

* Fake settings

Signed-off-by: Craig Perkins <[email protected]>

* Configure https client for sample extension plugin

Signed-off-by: Craig Perkins <[email protected]>

* Fix forbidden apis

Signed-off-by: Craig Perkins <[email protected]>

* spotlessApply

Signed-off-by: Craig Perkins <[email protected]>

* Uncomment lint

Signed-off-by: Craig Perkins <[email protected]>

* Remove settings

Signed-off-by: Craig Perkins <[email protected]>

* JDK 21

Signed-off-by: Craig Perkins <[email protected]>

* Add sample-extension-plugin/build.gradle to version bump

Signed-off-by: Craig Perkins <[email protected]>

* Remove duplicate changes in sample plugin build.gradle

Signed-off-by: Craig Perkins <[email protected]>

* remove other changes in sample plugin build.gradle

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
(cherry picked from commit f1ad865)

* Use PathUtils.get

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants