Skip to content
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

[WIP] Ruby 3 upgrade #2623

Closed
wants to merge 7 commits into from
Closed

[WIP] Ruby 3 upgrade #2623

wants to merge 7 commits into from

Conversation

sethboyles
Copy link
Member

@sethboyles sethboyles commented Jan 13, 2022

Working on Ruby 3 upgrade.

Biggest issue so far was changing keyword args: https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/

There is the https://github.com/ruby/ruby2_keywords gem, but we figured we would try to adapt to the new, stricter usage first. If it's too risky, we can try the gem instead

What needs to be done before this is good to go:

If the first 3 are done, and ruby 2.7 tests are passing, I think might be able to ahead and merge, and update the package in capi-release after. But it's probably best to have these ready to go at the same time.

We are unsure if the unit tests have adequate coverage of the different fog gems (e.g fog-aliyun, fog-google, etc). We have run into a few issue where we were using old versions of the fog gems that were using the now removed URI.escape. We are wondering if might run into similar errors when running CATS and BARAS against these providers.

@sethboyles sethboyles mentioned this pull request Jan 13, 2022
1 task
@FloThinksPi FloThinksPi linked an issue Jan 13, 2022 that may be closed by this pull request
1 task
sethboyles and others added 5 commits January 18, 2022 18:33
Co-authored-by: Seth Boyles <[email protected]>
Co-authored-by: Mona Mohebbi <[email protected]>
* In Ruby 3.0, regexes are immutable and can't have singleton methods defined

Co-authored-by: Seth Boyles <[email protected]>
Co-authored-by: Mona Mohebbi <[email protected]>
Co-authored-by: Seth Boyles <[email protected]>
Co-authored-by: Mona Mohebbi <[email protected]>
eql is primarily used as a mathematical equals. Using it here was
causing a divison by 0 error due to some confusion.

Co-authored-by: Seth Boyles <[email protected]>
Co-authored-by: Mona Mohebbi <[email protected]>
@sethboyles
Copy link
Member Author

sethboyles commented Jan 19, 2022

I think something about the Sinatra upgrade (2.0 -> 2.1) is causing some tests to fail:

 2) Sinatra::VCAP accessing a route that throws a low level exception should return json content type in the header
     Failure/Error: Unable to find /foo to read failed line

     ZeroDivisionError:
       divided by 0
     Shared Example Group: "http header content type" called from ./spec/unit/lib/sinatra/vcap_spec.rb:108
     # /foo:1
     # /bar:2

Our test calls this endpoint:

get '/div_0' do
1 / 0
rescue => e
e.set_backtrace(['/foo:1', '/bar:2'])
raise e
end

Which divides by zero, and the expectation is that Sinatra returns a 500. Looking at the Sinatra changelog, I'm not sure why this behavior would have changed...

Authored-by: Seth Boyles <[email protected]>
@sethboyles
Copy link
Member Author

sethboyles commented Jan 21, 2022

Reason for divide by 0 issues: sinatra/sinatra#1214.

def in_test_mode?
false
end

doesn't override helpers like this anymore:

module Helpers
def in_test_mode?
ENV['CC_TEST']
end
end

@sethboyles
Copy link
Member Author

Due to another fog issue, we ended up pinning fog-google to 1.7.1. I am not sure that version is compatible with Ruby 3, so we may need to help fog/fog-google#422 move forward so we can move to the newest version of fog-google.

@sethboyles
Copy link
Member Author

This has suddenly been made more pressing, as Ruby 3 (3.1?) is required for the new Jammy Jellyfish stemcells: https://bosh.io/docs/jammy-migration/#openssl-3

@tjvman
Copy link
Contributor

tjvman commented Mar 29, 2022

Closing, superseded by #2703

@tjvman tjvman closed this Mar 29, 2022
@moleske moleske deleted the ruby-3-upgrade branch November 2, 2024 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Jammy In Progress
Development

Successfully merging this pull request may close these issues.

Evaluate if CC runs Ruby 3.X
3 participants