-
Notifications
You must be signed in to change notification settings - Fork 183
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
Added Tests for Search Pipeline and Notifications Plugin #668
Added Tests for Search Pipeline and Notifications Plugin #668
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #668 +/- ##
==========================================
- Coverage 71.95% 71.80% -0.16%
==========================================
Files 91 95 +4
Lines 8001 8103 +102
==========================================
+ Hits 5757 5818 +61
- Misses 2244 2285 +41 ☔ View full report in Codecov by Sentry. |
Question, would this also work with opensearch serverless (aws)? |
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.
Was this code actually generated? The "right" way to do this is to add search pipelines to https://github.com/opensearch-project/opensearch-api-specification and then to generate the client.
I see there's a PR in opensearch-api-specification . If that PR is merged, then does that mean the search pipeline api for opensearch-py can be generated? Thanks. |
|
Any follow up on this ? .. We need search pipeline API |
@lambda-science, @ArbitraryYu, please feel free to contribute to the spec to get it merged. |
Hey @AbitraryYu, to avoid the generator error, we could tweak the code to first check if the parameter description exists before using it. Yet, I believe it's even better to include the parameter description that is missing in the spec. @dblock, what's your take on this? |
@AbitraryYu, please try fixing #710. So, that all APIs from spec will be generated by update_api workflow and PR will be raised automatically if changes detected. Consider raising PR for spec repo with missing descriptions or fix generator to skip using description if not present. Thank you. |
If the description is not required, the generator should gracefully handle that. |
The code is generated via nox, and I modified the generator in By the way, the raw link of the opensearch "https://raw.githubusercontent.com/opensearch-project/opensearch-api-specification/main/OpenSearch.openapi.json" seems giving me 404 (line 550-554), so I use my local version downloaded from last week. |
A side note, the latest version of opensearch (docker) require admin password, and I cannot get it run tests locally. I am not sure if this repository supports password parsing so I am using an older version: 2.11.1 (docker). |
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.
Let me try to help with the password issue.
In 2.12 you need a default password, https://opensearch.org/blog/replacing-default-admin-credentials/, this repo was updated to act accordingly AFAIK.
We're moving things around in opensearch-api-specification, so you might hit issues, opensearch-project/opensearch-api-specification#189
Iterate this change to green?
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.
Hello @AbitraryYu,
- It appears there might have been an issue during the generation process.
- Could you confirm if you ran
nox -rs generate
and it is successful? This command triggers both the generator and the formatter. If the formatter step was skipped, it might explain the extensive changes to files. Generally, with the formatter running, modifications should be limited to newly added APIs. - Feel free to reach out if you require any assistance. Your contribution is greatly appreciated!
@AbitraryYu, Thank you for implementing the requested changes! Could you also include tests for these generated APIs? |
Hi @saimedhi , I got confused where I should implement the tests. I saw |
|
Thank you for your contribution, @ArbitraryYu. The Search Pipeline and Notification APIs have now been added to opensearch-py. We would greatly appreciate your help in adding tests for the Notifications Plugin whenever you have the chance. |
Sorry for all the dirty commits, I accidentally committed some sensitive data to this branch and I attempt to remove it both locally and remotely. I already force push the git history so the my local repo feature branch cannot access it. However, this PR still have the stray commit that contain the sensitive data. I just submitted a Github support request for to clear the cached views but might need this PR's admin permission to actually take effect. Update: The affected commit seems to be hidden after 2 hours, would let you guys know if Github support need your support. Thank you. Update 2: The GitHub support team removed the affected commit cache and I confirmed the affected commit is no longer accessible, so I think the case is closed. Thank you. |
@@ -224,6 +224,7 @@ class as kwargs, or a string in the format of ``host[:port]`` which will be | |||
self.ingest = IngestClient(self) | |||
self.nodes = NodesClient(self) | |||
self.remote = RemoteClient(self) | |||
self.search_pipeline = SearchPipelineClient(self) |
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.
@ArbitraryYu, thanks for your contribution. Just a few adjustments needed.
- No modification needed for this file. In a recent PR,
self.search_pipeline = SearchPipelineClient(self)
was added.
opensearchpy/client/__init__.py
Outdated
@@ -224,6 +224,7 @@ class as kwargs, or a string in the format of ``host[:port]`` which will be | |||
self.ingest = IngestClient(self) | |||
self.nodes = NodesClient(self) | |||
self.remote = RemoteClient(self) | |||
self.search_pipeline = SearchPipelineClient(self) |
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.
No modification needed for this file
@@ -72,7 +72,6 @@ | |||
# broken YAML tests on some releases | |||
SKIP_TESTS = { | |||
# Warning about date_histogram.interval deprecation is raised randomly | |||
"OpenSearch-main/rest-api-spec/src/main/resources/rest-api-spec/test/search_pipeline/10_basic", | |||
"OpenSearch-main/rest-api-spec/src/main/resources/rest-api-spec/test/pit/10_basic", |
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.
Please remove the change OpenSearch-main/rest-api-spec/src/main/resources/rest-api-spec/test/search_pipeline/10_basic
to avoid blocking this PR, as two tests are currently failing.
It will be handled in #726 . Integration tests with OpenSearch 2.7 and 2.8 are failing due to a server bug, and I'll raise an issue in the appropriate repo.
@ArbitraryYu, please resolve the failing DCO check. |
846c25b
to
ead8373
Compare
For the DCO, I try to follow the DCO guide, |
It's probably easier to re-create the changes in the branch, or do https://code.dblock.org/2015/08/31/getting-out-of-your-first-git-mess.html.
|
Signed-off-by: AbitraryYu <nikkoyhc@gmail.com>
ead8373
to
82cebac
Compare
Signed-off-by: AbitraryYu <nikkoyhc@gmail.com>
…nflict. Signed-off-by: AbitraryYu <nikkoyhc@gmail.com>
Fixed the DCO, and the tests seems ok. |
|
||
|
||
class TestNotificationPlugin(OpenSearchTestCase): | ||
async def test_create_channel_notification(self) -> None: |
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.
- @AbitraryYu, please remove async from all the test cases in this file.
- After removing async, you might notice that some test cases fail. Please fix them.
- For example, test_delete_channel_configuration may fail. Remember, each test case is isolated, so create the configuration before deleting it within the same test case. See this reference. Thank you.
Signed-off-by: AbitraryYu <nikkoyhc@gmail.com>
@AbitraryYu, please try to fix failing tests. |
Signed-off-by: AbitraryYu <nikkoyhc@gmail.com>
I followed the example on test_index_management.py of this reference, and I got errors like:
How can I fix that? Meanwhile, the test_list_all_config() returns an empty list of config list, so I didn't write an |
@ArbitraryYu, follow these steps to resolve the errors:
|
Signed-off-by: AbitraryYu <nikkoyhc@gmail.com>
@dblock, I'm unable to merge the PR. Could you please review, approve, and merge it? Thank you! |
…project#668) * Added Tests for Notification and Search Pipeline.ml Signed-off-by: AbitraryYu <nikkoyhc@gmail.com> * Add back the lines of comment in indices.py during resolving merge conflict. Signed-off-by: AbitraryYu <nikkoyhc@gmail.com> * Fix notification plugin tests, from async def to def. Signed-off-by: AbitraryYu <nikkoyhc@gmail.com> * Fix test errors. Rename function names and rewrite assertion tests. Signed-off-by: AbitraryYu <nikkoyhc@gmail.com> * Fix formatting errors. Added typings to CONTENT. Signed-off-by: AbitraryYu <nikkoyhc@gmail.com> --------- Signed-off-by: AbitraryYu <nikkoyhc@gmail.com>
Description
Describe what this change achieves.
This change tries to solve #474
Issues Resolved
List any issues this PR will resolve, e.g. Closes [...].
If this is resolved, this closes #474
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.