-
Notifications
You must be signed in to change notification settings - Fork 47
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
Faraday 2 support for opensearch-transport 2 #76
Faraday 2 support for opensearch-transport 2 #76
Conversation
- Support Faraday 1.x and 2.x in opensearch-transport. - Made client autodetection not break if the detected HTTP client is there but the associated Faraday adapter is not. - Made the test setup require the referenced adapters. - Made it more clear in the README that Faraday uses adapters. [Fixes opensearch-project#59] Signed-off-by: Brian Hawley <brian_hawley@yahoo.com>
617359e
to
e270c8f
Compare
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.
See my comments in #75, get this PR in first on main, and then we can backport to 1.x once it's here?
- The Ruby < 2.7, Faraday 2+, and Typhoeus combination doesn't work. Adjusted the README and test setup accordingly. - Fix the MiniTest transport test setup. - Add extra opensearch-transport tests to the matrix for Faraday 1. Signed-off-by: Brian Hawley <brian_hawley@yahoo.com>
This works for me and I'll merge on green, thank you. If you want to improve upon this, consider changing how this faraday version is set for tests in GHA to avoid a huge complicated matrix of things. I would:
Alternatively, use https://github.com/thoughtbot/appraisal that makes testing very explicit and generates multiple Gemfile's. |
require 'faraday/typhoeus' | ||
rescue LoadError | ||
# Only needed for Faraday 2. | ||
end |
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.
Use an explicit Faraday::VERSION comparison to avoid rescue
.
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.
Looks like link checker is also failing, https://github.com/lostisland/faraday-typhoeus is not valid.
- Use Gem::Version comparison. - Fix the faraday-typhoeus links. Signed-off-by: Brian Hawley <brian_hawley@yahoo.com>
6e08ac7
to
e25dba8
Compare
@dblock I made the requested changes. |
Looks like some integration tests are failing, check those out? I'll keep clicking "run build" for you as needed. https://github.com/opensearch-project/opensearch-ruby/runs/7121455260?check_suite_focus=true
|
- Move the Faraday 1 tests to their own job. - Don't reference faraday-typhoeus during Faraday 1 tests. - Use ENV.key?('FARADAY_VERSION'). Signed-off-by: Brian Hawley <brian_hawley@yahoo.com>
@dblock I moved the Faraday 1 tests to their own job, as requested. I think the integration test problem was from faraday-typhoeus getting included during the Faraday 1 tests of Ruby 2.7.0 or higher. I put a constraint on that. Next test run will show if it worked. I agree that something like appraisal would be best to use in the long run, and would be up for doing that conversion later. Not a fan of gemspecs with As for the faraday-typhoeus problem with Ruby 2.6 and JRuby (which is 2.6 compatible), I'm going to make a PR to that repo to fix it. Later on, if that PR is merged, I can clean things up here. It's still not going to support Faraday 1, but Faraday has built-in support for Typhoeus in that version. |
Looks like you may need to wrap |
Signed-off-by: Brian Hawley <brian_hawley@yahoo.com>
@dblock weird, I didn't need to wrap In any case, doing so made it possible to make the conditions read better. Updated. |
I haven't audited the actions to make sure that they all apply to my case, of not being someone who releases these gems or sets tags and such. I tried to run the suite locally with https://github.com/nektos/act but several of the server setup steps don't really work in containers, even privileged ones, such as the "Increase system limits" steps or something in the Opendistro setup action. I was going to try to diagnose this later and get the suite running locally with |
Yeah act only gets you that far. But you can also just enable actions on your own fork. I think you go to https://github.com/BrianHawley/opensearch-ruby settings and it's a checkbox somewhere under Actions. That said, once this is merged GH won't think you're a noob anymore and will run your jobs on PRs. It's just being extra paranoid :) |
This LGTM, @VachaShah care to be the second reviewer? |
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.
LGTM! Thank you very much @BrianHawley for adding this support :)
@dblock @BrianHawley Does this need to backported to both 2.0 and 1.x? |
@VachaShah yes, both 2.0 and 1.x. It should be a simple cherry-pick to do so with no conflicts. I actually had another PR targeting 1.x (#75) but this is the one I got the testing done on. I gather from a comment by @dblock in that one that backport PRs are done automatically, so that process should be fine. |
* Faraday 2 support for opensearch-transport 2 - Support Faraday 1.x and 2.x in opensearch-transport. - Made client autodetection not break if the detected HTTP client is there but the associated Faraday adapter is not. - Made the test setup require the referenced adapters. - Made it more clear in the README that Faraday uses adapters. [Fixes #59] Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> * Additional requested fixes - The Ruby < 2.7, Faraday 2+, and Typhoeus combination doesn't work. Adjusted the README and test setup accordingly. - Fix the MiniTest transport test setup. - Add extra opensearch-transport tests to the matrix for Faraday 1. Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> * More requested fixes - Use Gem::Version comparison. - Fix the faraday-typhoeus links. Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> * More fixes and requested changes - Move the Faraday 1 tests to their own job. - Don't reference faraday-typhoeus during Faraday 1 tests. - Use ENV.key?('FARADAY_VERSION'). Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> * Make the version checks backwards compatible Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> (cherry picked from commit 60840f7)
* Faraday 2 support for opensearch-transport 2 - Support Faraday 1.x and 2.x in opensearch-transport. - Made client autodetection not break if the detected HTTP client is there but the associated Faraday adapter is not. - Made the test setup require the referenced adapters. - Made it more clear in the README that Faraday uses adapters. [Fixes #59] Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> * Additional requested fixes - The Ruby < 2.7, Faraday 2+, and Typhoeus combination doesn't work. Adjusted the README and test setup accordingly. - Fix the MiniTest transport test setup. - Add extra opensearch-transport tests to the matrix for Faraday 1. Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> * More requested fixes - Use Gem::Version comparison. - Fix the faraday-typhoeus links. Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> * More fixes and requested changes - Move the Faraday 1 tests to their own job. - Don't reference faraday-typhoeus during Faraday 1 tests. - Use ENV.key?('FARADAY_VERSION'). Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> * Make the version checks backwards compatible Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> (cherry picked from commit 60840f7)
* Faraday 2 support for opensearch-transport 2 - Support Faraday 1.x and 2.x in opensearch-transport. - Made client autodetection not break if the detected HTTP client is there but the associated Faraday adapter is not. - Made the test setup require the referenced adapters. - Made it more clear in the README that Faraday uses adapters. [Fixes #59] Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> * Additional requested fixes - The Ruby < 2.7, Faraday 2+, and Typhoeus combination doesn't work. Adjusted the README and test setup accordingly. - Fix the MiniTest transport test setup. - Add extra opensearch-transport tests to the matrix for Faraday 1. Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> * More requested fixes - Use Gem::Version comparison. - Fix the faraday-typhoeus links. Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> * More fixes and requested changes - Move the Faraday 1 tests to their own job. - Don't reference faraday-typhoeus during Faraday 1 tests. - Use ENV.key?('FARADAY_VERSION'). Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> * Make the version checks backwards compatible Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> (cherry picked from commit 60840f7) Co-authored-by: Brian Hawley <brian_hawley@yahoo.com>
* Faraday 2 support for opensearch-transport 2 (#76) * Faraday 2 support for opensearch-transport 2 - Support Faraday 1.x and 2.x in opensearch-transport. - Made client autodetection not break if the detected HTTP client is there but the associated Faraday adapter is not. - Made the test setup require the referenced adapters. - Made it more clear in the README that Faraday uses adapters. [Fixes #59] Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> * Additional requested fixes - The Ruby < 2.7, Faraday 2+, and Typhoeus combination doesn't work. Adjusted the README and test setup accordingly. - Fix the MiniTest transport test setup. - Add extra opensearch-transport tests to the matrix for Faraday 1. Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> * More requested fixes - Use Gem::Version comparison. - Fix the faraday-typhoeus links. Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> * More fixes and requested changes - Move the Faraday 1 tests to their own job. - Don't reference faraday-typhoeus during Faraday 1 tests. - Use ENV.key?('FARADAY_VERSION'). Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> * Make the version checks backwards compatible Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> (cherry picked from commit 60840f7) * [Backport 1.x] Remove deprecated escape_utils, and test fixes (#87) * Remove deprecated escape_utils. (#74) Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> * Backport test fixes from 2.0 Signed-off-by: Brian Hawley <brian_hawley@yahoo.com> Co-authored-by: Daniel (dB.) Doubrovkine <dblock@dblock.org> Co-authored-by: Brian Hawley <brian_hawley@yahoo.com> Co-authored-by: Daniel (dB.) Doubrovkine <dblock@dblock.org>
@VachaShah any chance of new opensearch-transport releases with this change soon? Maybe after #89 and #90 are merged? |
@BrianHawley just open an issue when you want a release so we can make these visible to a larger group I see #48 that should enable this project to release very often, too. |
there but the associated Faraday adapter is not.
[Fixes #59]
Description
This makes it possible to use opensearch-transport with Faraday 1 or 2.
Issues Resolved
Closes [#59] for opensearch-transport 2.x.
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.