-
Notifications
You must be signed in to change notification settings - Fork 120
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] undefined cluster_manager when running local mock #640
Comments
nhtruong
added
good first issue
Good for newcomers
and removed
untriaged
good first issue
Good for newcomers
labels
Nov 14, 2023
I'm also seeing this issue when trying to mock an OpenSearch instance using the elastic mocks library. I also didn't find any workable solutions to it yet. |
Do we need to fork https://www.npmjs.com/package/@elastic/elasticsearch-mock and add support for cluster manager? please feel free to do so! (that comes from https://opensearch.org/docs/latest/breaking-changes/#deprecate-non-inclusive-terms). |
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Caveat that I totally get if this is not the right place for this bug -- the 'opensearch mock' that I'm trying to build is not directly related to this repo, but I'm hoping someone here can help me out nonetheless.
What is the bug?
When running the opensearch client with a mocked connection, I get
TypeError: Cannot read properties of undefined (reading 'cluster_manager')
.Full trace:
How can one reproduce the bug?
There's a pattern of mocking opensearch which attempts to use the elasticsearch mock client and trick the opensearch api to accept the mock. See: #192, or https://stackoverflow.com/questions/71358008/mock-opensearch-client-in-jest-unit-test
However, clearly there has been drift -- in particular, the following fails:
I dug into the code myself and, as best I can tell, the error is occurring because OpenSearch is looking for a node and there's no filtering information or roles present on the fake client, so the node search fails. Unfortunately just setting a fake
nodeFilter
also fails -- if thenodeFilter
defaults to true, the code hangs; if false, it fails with aNoLivingConnectionsError
It's all running locally and faked, so I'd love if there was a way to disable the cluster management entirely. Is this possible from the client input parameters alone?
What is the expected behavior?
No error.
What is your host/environment?
Linux 20.04, OpenSearch 2.5
The text was updated successfully, but these errors were encountered: