-
Notifications
You must be signed in to change notification settings - Fork 34
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
Fixing failing tests #59
Conversation
Signed-off-by: Vacha Shah <vachshah@amazon.com>
Still failing :( |
Yeah :(. The tests with security are failing, this PR currently just fixes the ones without security. I missed to convert this to a draft. |
There is some issue with the setup for tests with security, all the tests have the following error:
I tried a few ways to fix it but haven't found a solution yet. Will continue looking. |
e2eb6d4
to
9bbb8a8
Compare
Maybe we can ask @davidlago to help out? |
The permissions issue is happening when calling the delete indices api for tests with secure OpenSearch Cluster. The tests run successfully for the OpenSearch cluster without security. I found opensearch-project/security#15 which states that the admin user might need a certificate. I looked through other clients and they all have the same kind of setup, call the delete indices api for cleanup but don't have this issue. @davidlago Any suggestions on how to fix this? |
Hi @VachaShah, Deleting all indices fails because it includes the security plugin configuration indices and the security plugin prohibits that action even for admin users (The error message is not great for this). By using an admin certificate, you become a "super admin" and have the ability to delete/restore all indices including the security plugin indices. A few options to consider:
(Run this if SECURE_INTEGRATION is true)
The first 2 commands are necessary to perform the demo configuration because the
The tests are currently running locally and get past the reported error with admin not having permissions. I will push a branch and try with CI as well. |
Awesome! Thank you @cwperks, the first option works perfectly to fix this issue. There are quite a few failing tests after that but it goes past the security permissions error which is great! |
Thanks @cwperks for the explanation. We did guess using certificates is going to provide super admin permissions and solve the problem. |
I still don't know why the other clients don't face this issue that have the same setup (for example: https://github.com/opensearch-project/opensearch-py/blob/main/opensearchpy/helpers/test.py#L83). Another part here is that the tests are still failing after the first option (@cwperks suggested to try the admin certificate to resolve that). On a separate note for tests, the test cases used in the Rust client are very extensive and heavy since they use the test cases from yaml tests from OpenSearch. I feel we could also decouple this and write required test cases for the client since all tests from OpenSearch might not be relevant. WDYT @saratvemulapalli @dblock? |
Hey @VachaShah I could be wrong, but this issue is probably also affecting the python client. There is only 1 test run when security is set to True for the python client and it doesn't extend When security is set to false: When security is set to true: |
Ah!! So thats why the python client is unaffected since it is not trying to delete the security indices for the tests. Thank you so much for this finding @cwperks! |
Signed-off-by: Vacha Shah <vachshah@amazon.com>
After adding the admin certificate to the tests for security (latest changes in this PR), some tests from the yaml test suite still fail with assertion errors like
|
Signed-off-by: Vacha Shah <vachshah@amazon.com>
@VachaShah is this a small amount that gets different search results? Maybe we can mark them ignore and open an issue? |
bac91c3
to
5de559f
Compare
Yeah its a small percentage of the whole test suite. I will create an issue for the same so that we can unblock the PRs to this repo. |
Signed-off-by: Vacha Shah <vachshah@amazon.com>
@dblock I have updated the PR with the changes and the CI is green now. |
Also, many thanks to @cwperks for helping with the security exception issue, the code in this PR for adding admin certificate is entirely due to his effort 🙇🏼♀️ |
@VachaShah What is the fall out from this change (tests removed?), open an issue for followup items? |
Created issue #66 for the fall out. |
Hi @cwperks @VachaShah @dblock - I've landed here after scouring some of the bugtracker to check on the status of opensearch-project/opensearch-clients#58 (sidenote / bonus: a few items there are now complete, and can be checked-off). As a consumer of the Python client library I think I'd be marginally more comfortable with the test coverage if the same tests ran in both HTTP and HTTPS modes. Given that the test suite runs twice, once for each, the coverage and behaviour should be fine, but I'm wondering if I could offer (and whether you would accept) any contribution time to get rid of that branch condition, likely by using a similar client-certificate approach to here. |
Oops, I forgot to mention (partly for my own potential future reference): I think that the key place where the tests branch in the Python client test suite is this section of code. |
Signed-off-by: Vacha Shah vachshah@amazon.com
Description
This is the first attempt at fixing tests failing in the CI. The issue is described in detail in #58.
Issues Resolved
Fixes #58
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.