-
Notifications
You must be signed in to change notification settings - Fork 282
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
[BUG-1402] Return HTTP 409 on version confict when creating & updating tenants - added relevant unit test #3580
Conversation
src/test/java/org/opensearch/security/dlic/rest/api/TenantsActionTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/opensearch/security/dlic/rest/api/TenantsActionTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/opensearch/security/dlic/rest/api/TenantsActionTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/opensearch/security/dlic/rest/api/TenantsActionTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/opensearch/security/dlic/rest/api/TenantsActionTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/opensearch/security/dlic/rest/api/TenantsActionTest.java
Outdated
Show resolved
Hide resolved
@prabhask5 Thanks for the contribution of the test - much appreciated! I've left feedback please address and let me know and I'll take another look. |
@peternied Alright I refactored the added test to test only two parallel requests and I'm getting a consistent one 409 and one 201 codes, which should be good. The only thing that changes from test run to test run is which request is the "conflict" one, but I think I account for this when checking the description with the get request. Let me know if you need me to make any other changes! TY! |
Codecov Report
@@ Coverage Diff @@
## main #3580 +/- ##
===========================================
+ Coverage 0 63.14% +63.14%
- Complexity 0 3561 +3561
===========================================
Files 0 284 +284
Lines 0 20618 +20618
Branches 0 3390 +3390
===========================================
+ Hits 0 13019 +13019
- Misses 0 5923 +5923
- Partials 0 1676 +1676 |
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 for adding this test @prabhask5.
src/test/java/org/opensearch/security/dlic/rest/api/TenantInfoActionTest.java
Show resolved
Hide resolved
src/test/java/org/opensearch/security/dlic/rest/api/TenantInfoActionTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/opensearch/security/dlic/rest/api/TenantInfoActionTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/opensearch/security/dlic/rest/api/TenantInfoActionTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/opensearch/security/dlic/rest/api/TenantInfoActionTest.java
Show resolved
Hide resolved
Async tests are on my mind today, see this PR [1] for an example of how I've implemented async tests + validation. Those utilities might be useful, feel free to merge my branch onto this change if it helps your development. |
I restructured the test using streams and the AsyncActions.java file from #3601 - let me know of other changes, ty! |
We can wait until #3601 merge to ensure any conflicts are resolved. |
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 the test @prabhask5.
@prabhask5 please take a look at the test failures, I'm going to hold off on another review until those are passing. Please let us know if you need help with an issue. |
@prabhask5 if you are not ready to continue work on this PR, we can go ahead and close it, and re-open at a later time. Please let us know! |
@peternied The errors that I was getting in the test were related to java not being able to find import org.opensearch.test.framework.AsyncActions; when it does exist (which is used in your PR as well), I merged main into this PR to try to solve this error, but if it does not fix it, do you have any fixes going forward? |
@prabhask5 Checkout this guide [1] on rebasing it might help you get unblocked. |
Signed-off-by: Prabhas Kurapati <[email protected]>
Signed-off-by: Prabhas Kurapati <[email protected]>
Signed-off-by: Prabhas Kurapati <[email protected]>
3d3c6d5
to
6791c7a
Compare
@peternied I think I rebased so feel free to unblock the tests. TY! |
I'm going to make a new PR to see if that fixes things. |
@prabhask5 Could you link the new PR? |
Here: #3673 |
Description
Added new TenantsActionApiTest file to put api unit tests for the /api/tenants api call- additionally wrote new unit test to test for parallel PUT /tenant/{name} calls, that they successfully return a 409 call and retry the call.
Category (Enhancement, New feature, Bug fix, Test fix, Refactoring, Maintenance, Documentation)
Test fix
Why these changes are required?
There was no test that checked for the behavior mentioned in the linked ticket, so previously we didn't know if the issue still existed or not (it apparently was fixed before), to make sure this doesn't happen again for this particular case, I decided to write a concrete test for it.
What is the old behavior before changes and new behavior after changes?
Test was added, there's no behavior change?
Issues Resolved
Testing
Added new tenant action unit test to test parallel tenant api calls.
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.