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 IT tests with security plugin (#335) #1986

Merged

Conversation

Yury-Fridlyand
Copy link
Collaborator

Description

This PR adds a new IT gradle task: integTestWithSecurity. It starts a cluster with security plugin installed (it takes latest snapshot), configures cluster, http client for tests and runs one test which required to be run with security plugin.
A new GHA is added which runs this test task.

Please, see team review and discussion in Bit-Quill#335.

Issues Resolved

fixes #1713

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc 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.

* Add extra IT flow.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Remove unneeded files.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Typo fix.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Fix GHA matrix syntax.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Fix GHA matrix syntax.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Code clean up.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Optimize downloading.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Apply suggestions from code review

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

Co-authored-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Update integ-test/build.gradle

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

Co-authored-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Typo fix.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Rework implementation.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Address PR review.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Address PR feedback + some fixes.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

---------

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Co-authored-by: Andrew Carbonetto <andrewc@bitquilltech.com>
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
@codecov
Copy link

codecov bot commented Aug 18, 2023

Codecov Report

Merging #1986 (600cbde) into main (bb3c340) will decrease coverage by 0.20%.
Report is 2 commits behind head on main.
The diff coverage is n/a.

@@             Coverage Diff              @@
##               main    #1986      +/-   ##
============================================
- Coverage     97.52%   97.33%   -0.20%     
- Complexity     4655     4656       +1     
============================================
  Files           408      408              
  Lines         11952    12063     +111     
  Branches        829      829              
============================================
+ Hits          11656    11741      +85     
- Misses          289      315      +26     
  Partials          7        7              
Flag Coverage Δ
sql-engine 97.33% <ø> (-0.20%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 51 files with indirect coverage changes

'plugins.security.allow_unsafe_democertificates' : 'true',

'plugins.security.allow_default_init_securityindex' : 'true',
//'plugins.security.authcz.admin_dn' : 'CN=kirk,OU=client,O=client,L=test,C=de',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a part of demo configuration, I replated it with example from docs. Not sure how/whether it works.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the subject of the admin certificate. You most likely will not need it for doing testing using testClusters.

You would need it if you plan to use securityadmin. Copying the demo config should be fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @cwperks!
I updated config and added a comment in 23c83ec.

@@ -108,6 +187,7 @@ dependencies {
testImplementation group: 'com.h2database', name: 'h2', version: '2.2.220'
testImplementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.41.2.2'
testImplementation group: 'com.google.code.gson', name: 'gson', version: '2.8.9'
testCompileOnly 'org.apiguardian:apiguardian-api:1.1.2'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain why this is here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To remove hundreds of

warning: unknown enum constant Status.STABLE

from log. Nice to have in general.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
@seankao-az
Copy link
Collaborator

seankao-az commented Aug 18, 2023

With this change, can we now safely remove this line or not?
https://github.com/opensearch-project/sql/pull/1986/files#diff-862918fc998b069454d1afe817b72a1765ad64633f8e726ef74d6517f93fda5fL309
Can we add a condition to exclude it only if security plugin is enabled

acarbonetto
acarbonetto previously approved these changes Aug 18, 2023
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
@Yury-Fridlyand
Copy link
Collaborator Author

With this change, can we now safely remove this line or not? https://github.com/opensearch-project/sql/pull/1986/files#diff-862918fc998b069454d1afe817b72a1765ad64633f8e726ef74d6517f93fda5fL309 Can we add a condition to exclude it only if security plugin is enabled

I moved this test to another directory, so it won't be executed as part of main IT task.
integTestWithSecurity runs it with security plugin on every push/PR.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
@Yury-Fridlyand Yury-Fridlyand merged commit 7e3a718 into opensearch-project:main Aug 21, 2023
20 of 21 checks passed
@Yury-Fridlyand Yury-Fridlyand deleted the integ-IT-with-security branch August 21, 2023 17:25
@opensearch-trigger-bot
Copy link
Contributor

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/sql/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/sql/backport-2.x
# Create a new branch
git switch --create backport/backport-1986-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 7e3a718f1b7d9100fbac2ee8317fd35042b63b39
# Push it to GitHub
git push --set-upstream origin backport/backport-1986-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/sql/backport-2.x

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

@vamsi-amazon
Copy link
Member

@Yury-Fridlyand Will the integTestWithSecurity get triggered during build pipeline steps?

@Yury-Fridlyand
Copy link
Collaborator Author

@vamsi-amazon,
By jenkins? No. Should be?

@vamsi-amazon
Copy link
Member

https://github.com/opensearch-project/opensearch-build/blob/main/scripts/default/integtest.sh
Integ tests in release pipeline are triggered using above script.
Instead of having a separate command, can we use Security Enabled flag.?
Cc: @seankao-az

@opensearch-trigger-bot
Copy link
Contributor

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/sql/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/sql/backport-2.x
# Create a new branch
git switch --create backport/backport-1986-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 7e3a718f1b7d9100fbac2ee8317fd35042b63b39
# Push it to GitHub
git push --set-upstream origin backport/backport-1986-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/sql/backport-2.x

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

Yury-Fridlyand added a commit to Bit-Quill/opensearch-project-sql that referenced this pull request Aug 23, 2023
* Run IT tests with security plugin (#335)

* Add extra IT flow.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Remove unneeded files.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Typo fix.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Fix GHA matrix syntax.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Fix GHA matrix syntax.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Code clean up.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Optimize downloading.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Apply suggestions from code review

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

Co-authored-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Update integ-test/build.gradle

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

Co-authored-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Typo fix.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Rework implementation.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Address PR review.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Address PR feedback + some fixes.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

---------

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Co-authored-by: Andrew Carbonetto <andrewc@bitquilltech.com>

* Minor fix.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Address PR feedback.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

* Typo fix.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>

---------

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Co-authored-by: Andrew Carbonetto <andrewc@bitquilltech.com>
(cherry picked from commit 7e3a718)
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Yury-Fridlyand added a commit that referenced this pull request Aug 23, 2023
* Run IT tests with security plugin (#335)

* Add extra IT flow.



* Remove unneeded files.



* Typo fix.



* Fix GHA matrix syntax.



* Fix GHA matrix syntax.



* Code clean up.



* Optimize downloading.



* Apply suggestions from code review





* Update integ-test/build.gradle





* Typo fix.



* Rework implementation.



* Address PR review.



* Address PR feedback + some fixes.



---------




* Minor fix.



* Address PR feedback.



* Typo fix.



---------



(cherry picked from commit 7e3a718)

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Co-authored-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Co-authored-by: Andrew Carbonetto <andrewc@bitquilltech.com>
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.

[FEATURE] Run integration tests with security plugin enabled
7 participants