Fix the unit test failures caused by #223#226
Merged
mashhurs merged 2 commits intologstash-plugins:mainfrom Mar 17, 2025
Merged
Fix the unit test failures caused by #223#226mashhurs merged 2 commits intologstash-plugins:mainfrom
mashhurs merged 2 commits intologstash-plugins:mainfrom
Conversation
andsel
reviewed
Mar 17, 2025
Contributor
andsel
left a comment
There was a problem hiding this comment.
Left a comment to improve readability
Comment on lines
+95
to
+99
| begin | ||
| allow(es_client).to receive(:info).and_raise(Elasticsearch::Transport::Transport::Errors::BadRequest.new) | ||
| rescue NameError # NameError: uninitialized constant Elasticsearch::Transport | ||
| allow(es_client).to receive(:info).and_raise(Elastic::Transport::Transport::Errors::BadRequest.new) | ||
| end |
Contributor
There was a problem hiding this comment.
I think that being more explicit on the intention would help to understand better:
def elastic_ruby_client8_available?
Elasticsearch::Transport
return false
rescue NameError # NameError: uninitialized constant Elasticsearch::Transport if Elastic Ruby client is not available
return true
end
before do
...
unless elastic_ruby_client8_available?
allow(es_client).to receive(:info).and_raise(Elasticsearch::Transport::Transport::Errors::BadRequest.new)
else
allow(es_client).to receive(:info).and_raise(Elastic::Transport::Transport::Errors::BadRequest.new)
end
...I know it's more verbose but maybe more explicit for the reader.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the unit test failures caused by #223.
The failures became visible once LS-core upgraded elasticsearch-ruby client to 8.x.