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
Convert ENV['AWS_MAX_ATTEMPTS'] string value to int #2319
Conversation
Thanks for opening this pull request. |
I would also want to fix the test to catch this error before merging, too. |
@mullermp - We only want to convert it to an integer if it is set. If it is unset, |
Ah yeah! Sorry about that. |
@mullermp - I updated the tests to not stub
After my change:
|
Thanks for taking the initiative on this. Please see my feedback. :) Happy to also contribute here. |
@mullermp - I am totally open to you collaborating on this. I am out of time today but I can take another look tomorrow. Regarding the test cases: '1' and '-1' make sense. 1 does not as you will immediately get a I was just trying to make the least amount of impact/changes while still being able to prove out the failure and my fix. If you have a preferred refactor or approach to accomplish this I am more than willing to give it a shot or let you hijack this PR and take it over the finish line. My ruby is honestly fairly rusty these days. Thanks! |
No worries! I went ahead and updated your branch. I think these changes are less intrusive. It was unfortunate on our part that ENV was stubbed as a hash, allowing integers to be set when in reality they never could be. It'd be better instead of using |
@mullermp - Awesome, thanks for your prompt work on this. I appreciate it. |
Thanks for the contribution! (and for opening this issue) |
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
With ruby 2.7.1 I am unable to set
AWS_MAX_ATTEMPTS
to a custom value with an environment variable.This was likely missed with tests because of the stubbing of
ENV
here: https://github.com/aws/aws-sdk-ruby/blob/master/gems/aws-sdk-core/spec/shared_spec_helper.rb#L19This simple change keeps tests passing and will enable you to set
AWS_MAX_ATTEMPTS
to a String in ruby, which then gets converted into an integer when resolved.Thanks for your time!