-
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
Wide range of integration tests. #2139
Wide range of integration tests. #2139
Conversation
0b61666
to
614a87a
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 really like the format of the Search Operation tests, but I don't think the matchers belong in this project, or at least if we merge them we will immediately want to migrate them into the high level rest client or a OpenSearch centric test framework - what do you think of this?
src/integrationTest/java/org/opensearch/security/SnapshotSteps.java
Outdated
Show resolved
Hide resolved
src/integrationTest/java/org/opensearch/security/SnapshotSteps.java
Outdated
Show resolved
Hide resolved
src/integrationTest/java/org/opensearch/test/framework/cluster/LocalOpenSearchCluster.java
Outdated
Show resolved
Hide resolved
src/integrationTest/java/org/opensearch/test/framework/cluster/TestRestClient.java
Outdated
Show resolved
Hide resolved
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
class BulkResponseContainExceptionsAtIndexMatcher extends TypeSafeDiagnosingMatcher<BulkResponse> { |
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.
These matchers are really great, but I don't think they belong in the security plugin - I think they would be better suited as part of the high-level rest client, what do you think about moving them to that project?
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.
Looking back at this comment, its major scope creep! Lets move forward with the great work you've got here and we can enhance the HLRC in another effort
...ionTest/java/org/opensearch/test/framework/matcher/ClusterContainSuccessSnapshotMatcher.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Lukasz Soszynski <[email protected]>
8741946
to
dd76d67
Compare
|
||
class ClusterContainsDocumentWithFieldValueMatcher extends TypeSafeDiagnosingMatcher<Client> { | ||
|
||
private static final Logger log = LogManager.getLogger(LocalCluster.class); |
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.
Nit: Can we change the logger to be a different class?
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.
done :)
Codecov Report
@@ Coverage Diff @@
## main #2139 +/- ##
============================================
+ Coverage 61.01% 61.02% +0.01%
- Complexity 3229 3232 +3
============================================
Files 256 257 +1
Lines 18101 18110 +9
Branches 3229 3229
============================================
+ Hits 11044 11052 +8
- Misses 5475 5476 +1
Partials 1582 1582
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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 @lukasz-soszynski-eliatra for this PR. SearchOperationTest looks really good and ty for adding the Matchers. I have one change to request to make SearchRequestFactory
class final.
|
||
SearchScrollRequest scrollRequest = getSearchScrollRequest(searchResponse); | ||
|
||
assertThatThrownBy(() -> restHighLevelClient.scroll(scrollRequest, DEFAULT), statusException(FORBIDDEN)); |
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.
For my understanding, why does this request fail even though DOUBLE_READER_USER
has slightly broader set of permissions than LIMITED_READ_USER
.
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.
The result of request restHighLevelClient.scroll(scrollRequest, DEFAULT)
is HTTP response with 403 status code because the DOUBLE_READER_USER
is lacking cluster permission indices:data/read/scroll
.
@@ -380,7 +380,7 @@ public AuthcDomain jwtHttpAuthenticator(String headerName, String signingKey) { | |||
return this; | |||
} | |||
|
|||
public AuthcDomain challengingAuthenticator(String type) { | |||
public AuthcDomain httpAuthenticatorWithChallenge(String type) { |
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 👍
|
||
import static java.util.concurrent.TimeUnit.MINUTES; | ||
|
||
public class SearchRequestFactory { |
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.
we should make this class final
since it contains static methods only
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.
Done
} catch (URISyntaxException ex) { | ||
throw new RuntimeException("Incorrect URI syntax", ex); | ||
} | ||
} |
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.
nice
@lukasz-soszynski-eliatra I'm ready to approve it. Can you please sign-off your commits, so we can get DCO check to be successful to have passing CI. |
Signed-off-by: Lukasz Soszynski <[email protected]>
cbb2d48
to
0a35c03
Compare
Thanks, commits corrected. |
Adds: 1. Search requests test 2. Basic auth tests 3. A package containing matchers that can be used for future tests Signed-off-by: Lukasz Soszynski <[email protected]> Signed-off-by: Lukasz Soszynski <[email protected]> Signed-off-by: Stephen Crawford <[email protected]>
Signed-off-by: Lukasz Soszynski [email protected]
Description
Adds:
Issues Resolved
[List any issues this PR will resolve]
Testing
Production code can be treated as a test for 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.