-
Notifications
You must be signed in to change notification settings - Fork 281
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
New test framework #1967
New test framework #1967
Conversation
59f136c
to
484d72d
Compare
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.
Some comments after an initial pass, I'll circle back with a complete review
src/newTest/java/org/opensearch/test/AbstractIntegrationTest.java
Outdated
Show resolved
Hide resolved
src/newTest/java/org/opensearch/test/GenericIntegrationTest.java
Outdated
Show resolved
Hide resolved
src/newTest/java/org/opensearch/test/GenericIntegrationTest.java
Outdated
Show resolved
Hide resolved
src/newTest/java/org/opensearch/test/GenericIntegrationTest.java
Outdated
Show resolved
Hide resolved
src/newTest/java/org/opensearch/test/GenericIntegrationTest.java
Outdated
Show resolved
Hide resolved
src/newTest/java/org/opensearch/test/framework/certificate/Certificates.java
Outdated
Show resolved
Hide resolved
src/newTest/java/org/opensearch/test/framework/cluster/ClusterConfiguration.java
Outdated
Show resolved
Hide resolved
src/newTest/java/org/opensearch/test/framework/cluster/ClusterConfiguration.java
Outdated
Show resolved
Hide resolved
src/newTest/java/org/opensearch/test/framework/cluster/ClusterConfiguration.java
Outdated
Show resolved
Hide resolved
src/newTest/java/org/opensearch/test/framework/cluster/ClusterConfiguration.java
Outdated
Show resolved
Hide resolved
src/newTest/java/org/opensearch/test/framework/cluster/ContextHeaderDecoratorClient.java
Outdated
Show resolved
Hide resolved
src/newTest/java/org/opensearch/test/framework/cluster/PortAllocator.java
Outdated
Show resolved
Hide resolved
src/newTest/java/org/opensearch/test/framework/cluster/PortAllocator.java
Outdated
Show resolved
Hide resolved
src/newTest/java/org/opensearch/test/framework/cluster/SocketUtils.java
Outdated
Show resolved
Hide resolved
src/newTest/java/org/opensearch/test/framework/cluster/TestRestClient.java
Outdated
Show resolved
Hide resolved
src/newTest/java/org/opensearch/test/framework/cluster/TestRestClient.java
Outdated
Show resolved
Hide resolved
Thanks for the contribution, this is a great step forward in how tests are authored in this codebase. I left a lot of feedback, lets work down that list and as we resolve some of those conversations we can checkpoint where this change is at. |
@jochenkressin @lukasz-soszynski-eliatra please amend your commits adding DCO to them, the check is failing. Thanks! |
ca1793e
to
3995774
Compare
I've reviewed the outstanding comments and resolved a bunch, thanks! |
987fdb0
to
88394ec
Compare
@davidlago @peternied |
@lukasz-soszynski-eliatra the build has run and it looked like it failed https://github.com/opensearch-project/security/runs/7877581013?check_suite_focus=true I believe it will continue to trigger automatically on your fork as well as on this pull request as I have approved it. Let us know if you are seeing any 'waiting for approval' gates. |
88394ec
to
77080b0
Compare
I rebased branch |
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.
I've resolved a bunch of the previous comments that don't need any updates, great progress. The list of changes is going down, but the inclusive name of cluster manager is still a bigger lingering presence in the code.
src/integrationTest/java/org/opensearch/test/framework/certificate/Certificates.java
Outdated
Show resolved
Hide resolved
src/newTest/java/org/opensearch/test/framework/cluster/NestedValueMap.java
Outdated
Show resolved
Hide resolved
src/newTest/java/org/opensearch/test/framework/cluster/OpenSearchClientProvider.java
Outdated
Show resolved
Hide resolved
src/newTest/java/org/opensearch/test/framework/cluster/SocketUtils.java
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## main #1967 +/- ##
============================================
- Coverage 60.99% 60.96% -0.03%
+ Complexity 3226 3225 -1
============================================
Files 256 256
Lines 18075 18072 -3
Branches 3225 3224 -1
============================================
- Hits 11024 11017 -7
- Misses 5472 5476 +4
Partials 1579 1579
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
412f050
to
f7e0738
Compare
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.
I've created some pull requests for specific updates, which you can take or leave, but there seems to be some kind of warnings that are shown when the tests run that seem like they might indicate there is a problem
src/integrationTest/java/org/opensearch/test/framework/cluster/ClusterManager.java
Show resolved
Hide resolved
e4c0f63
to
26405c4
Compare
Retriggered the CI - I think we are super close! |
Signed-off-by: Kacper Trochimiak <[email protected]>
Signed-off-by: Kacper Trochimiak <[email protected]>
Signed-off-by: Kacper Trochimiak <[email protected]>
Signed-off-by: Kacper Trochimiak <[email protected]>
Signed-off-by: Kacper Trochimiak <[email protected]>
Signed-Off-By: Nils Bandener <[email protected]>
Signed-Off-By: Nils Bandener <[email protected]>
Removes the following messages from the output: 2022-08-25 12:51:21 SUITE-SecurityRolesTests-seed#[BB25A03A663EB2F7] WARN Salt:48 - If you plan to use field masking pls configure compliance salt e1ukloTsQlOgPquJ to be a random string of 16 chars length identical on all nodes 2022-08-25 12:51:21 SUITE-SecurityRolesTests-seed#[BB25A03A663EB2F7] ERROR SinkProvider:64 - Default endpoint could not be created, auditlog will not work properly. 2022-08-25 12:51:21 SUITE-SecurityRolesTests-seed#[BB25A03A663EB2F7] WARN AuditMessageRouter:61 - No default storage available, audit log may not work properly. Please check configuration. Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Lukasz Soszynski <[email protected]>
Signed-Off-By: Nils Bandener <[email protected]>
Signed-Off-By: Nils Bandener <[email protected]>
6a67779
to
08d6500
Compare
…y class NodeAndClusterIdConverter during tests execution Signed-off-by: Lukasz Soszynski <[email protected]>
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.
Last item before we merge is the copyright headers in the test cases files - could you do a quick pass over any files that can remove this since they are net new for this project?
Please do not modify these in any files that have been copied from other codebases.
src/integrationTest/java/org/opensearch/security/SecurityRolesTests.java
Outdated
Show resolved
Hide resolved
src/integrationTest/java/org/opensearch/test/framework/cluster/ClusterManager.java
Show resolved
Hide resolved
Signed-Off-By: Nils Bandener <[email protected]>
@opensearch-project/security Could we have another reviewer take a look? |
integrationTestImplementation 'junit:junit:4.13.2' | ||
integrationTestImplementation "org.opensearch.plugin:reindex-client:${opensearch_version}" | ||
integrationTestImplementation "org.opensearch.plugin:percolator-client:${opensearch_version}" | ||
integrationTestImplementation 'commons-io:commons-io:2.11.0' |
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.
I'm curious, why do dependencies need to be repeated for integrationTestImplementation
if we already have an entry for testImplementation
?
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.
As the goal of the project is the replacement of large parts of the old legacy tests, we want to keep the test definitions as separate as possible.
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.
Ty so much for this PR!
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. |
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.
Does this file come from floragunn repo or is it a new file ? If it is a new file we should remove the floragunn license section
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.
This should also apply to any other files in this PR
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.
This is based on code from floragunn
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.
This is based on floragunn code.
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.
okay
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.
@lukasz-soszynski-eliatra @nibix Can you please provide the link to the source repo where this is based off of? This would be super helpful to add it to merge-commit
protected final static TestSecurityConfig.User NEGATED_REGEX = new TestSecurityConfig.User("negated_regex_user") | ||
.roles(new Role("negated_regex_role").indexPermissions("read").on("/^[a-z].*/") | ||
.clusterPermissions("cluster_composite_ops")); | ||
|
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.
Ty for adding this! Can you please add a line or two comment over here explaining the idea behind these tests? I feel it would be helpful to understand as it took me a while
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.
This could be addressed in a separate PR as it isn't a blocking change
src/integrationTest/java/org/opensearch/test/framework/TestSecurityConfig.java
Show resolved
Hide resolved
src/integrationTest/java/org/opensearch/test/framework/TestSecurityConfig.java
Show resolved
Hide resolved
src/integrationTest/java/org/opensearch/test/framework/certificate/Certificates.java
Show resolved
Hide resolved
...integrationTest/java/org/opensearch/test/framework/cluster/ContextHeaderDecoratorClient.java
Show resolved
Hide resolved
src/integrationTest/java/org/opensearch/test/framework/cluster/LocalOpenSearchCluster.java
Show resolved
Hide resolved
...nTest/java/org/opensearch/test/framework/cluster/MinimumSecuritySettingsSupplierFactory.java
Outdated
Show resolved
Hide resolved
src/integrationTest/java/org/opensearch/test/framework/cluster/SocketUtils.java
Outdated
Show resolved
Hide resolved
src/integrationTest/java/org/opensearch/test/framework/cluster/SocketUtilsTests.java
Outdated
Show resolved
Hide resolved
…dded. Signed-off-by: Lukasz Soszynski <[email protected]>
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.
Thank you! Can you please respond to couple of comments above and we will get this merged
This is a giant PR and it has two approvals so I am merging. I know there are some outstanding comments - we can handle outstanding comments asynchronously. @DarshitChanpura if there are any you are feeling passionate about please create issues for follow up or pull requests to resolve. |
This is the first iteration of a new framework for integration tests. The main focus is on conciseness and self-contained test. The framework offers: A programmatic way of defining the cluster setup A programmatic way of defining users and roles A programmatic way of defining indices A REST client with methods tailored for testing This is now all part of the test class, so you do not need to jump around in various configuration files to get an overview on the test setup. There are of course still a lot of features missing, like setting up test data. I propose to add these features in increments. Signed-off-by: Nils Bandener <[email protected]> Signed-off-by: Jochen Kressin <[email protected]> Signed-off-by: Lukasz Soszynski <[email protected]> Signed-off-by: Kacper Trochimiak <[email protected]> Signed-off-by: Nils Bandener <[email protected]> Signed-off-by: Peter Nied <[email protected]> Co-authored-by: Jochen Kressin <[email protected]> Co-authored-by: Lukasz Soszynski <[email protected]> Co-authored-by: Kacper Trochimiak <[email protected]> Co-authored-by: Peter Nied <[email protected]>
This is the first iteration of a new framework for integration tests. The main focus is on conciseness and self-contained test. The framework offers: A programmatic way of defining the cluster setup A programmatic way of defining users and roles A programmatic way of defining indices A REST client with methods tailored for testing This is now all part of the test class, so you do not need to jump around in various configuration files to get an overview on the test setup. There are of course still a lot of features missing, like setting up test data. I propose to add these features in increments. Signed-off-by: Nils Bandener <[email protected]> Signed-off-by: Jochen Kressin <[email protected]> Signed-off-by: Lukasz Soszynski <[email protected]> Signed-off-by: Kacper Trochimiak <[email protected]> Signed-off-by: Nils Bandener <[email protected]> Signed-off-by: Peter Nied <[email protected]> Co-authored-by: Jochen Kressin <[email protected]> Co-authored-by: Lukasz Soszynski <[email protected]> Co-authored-by: Kacper Trochimiak <[email protected]> Co-authored-by: Peter Nied <[email protected]> Signed-off-by: Stephen Crawford <[email protected]>
Signed-Off-By: Nils Bandener [email protected]
Description
This is the first iteration of a new framework for integration tests. The main focus is on conciseness and self-contained test. The framework offers:
This is now all part of the test class, so you do not need to jump around in various configuration files to get an overview on the test setup. There are of course still a lot of features missing, like setting up test data. I propose to add these features in increments.
The new framework and tests live in a new source folder called "newTest" so they do not interfere with the already existing tests
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.