Skip to content

Commit

Permalink
Merge pull request #4039 from DataDog/sarahchen6/add-ruby-3.4-github
Browse files Browse the repository at this point in the history
Add Ruby 3.4.0-preview2 support for github workflow tests
  • Loading branch information
sarahchen6 authored Nov 6, 2024
2 parents 2fae103 + eb944e7 commit 761daa4
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/test-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
- '3.1'
- '3.2'
- '3.3'
- '3.4'
# ADD NEW RUBIES HERE
name: Test (${{ matrix.os }}, ${{ matrix.ruby }})
runs-on: ${{ matrix.os }}
Expand All @@ -40,11 +41,9 @@ jobs:
ruby-version: ${{ matrix.ruby }}
rubygems: 3.3.26
bundler: 2.3.26 # needed to fix issue with steep on Ruby 3.0/3.1
- if: ${{ matrix.ruby == '3.3' }}
# Specify gem version for 3.4 because default version (3.6.0.dev)
# leads to an incorrect gem root path
- if: ${{ matrix.ruby == '3.3' || matrix.ruby == '3.4' }}
run: gem update --system 3.5.21
- run: |
ruby -v
gem -v
bundler -v
- run: bundle install
- run: bundle exec rake spec:main
1 change: 1 addition & 0 deletions .github/workflows/test-yjit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
ruby:
- '3.2'
- '3.3'
- '3.4'
# ADD NEW RUBIES HERE
rubyopt:
- '--yjit'
Expand Down
2 changes: 2 additions & 0 deletions spec/datadog/core/environment/execution_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ def test_it_does_something_useful
Open3.capture3('ruby', stdin_data: script)
end

# Ruby 3.4 outputs an exception instead of the information to be asserted because of the forked process.
pending('Pending for Ruby 3.4.') if RUBY_VERSION.start_with?('3.4.')
expect(err).to include('ACTUAL:true')
end
end
Expand Down
10 changes: 6 additions & 4 deletions spec/datadog/core/error_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ def call
expect(error.message).to eq('wrapper layer')

# Outer-most error first, inner-most last
# Ruby 3.4 adjusts the format of error messages and Hash#inspect renderings
# https://www.ruby-lang.org/en/news/2024/10/07/ruby-3-4-0-preview2-released/
wrapper_error_message = /in.*wrapper': wrapper layer \(RuntimeError\)/
wrapper_caller = /from.*in `call'/
wrapper_caller = /from.*in ['`]call'/
middle_error_message = /in.*middle': middle cause \(RuntimeError\)/
middle_caller = /from.*in `wrapper'/
root_error_message = /in `root': root cause \(RuntimeError\)/
root_caller = /from.*in `middle'/
middle_caller = /from.*in ['`]wrapper'/
root_error_message = /in ['`]root': root cause \(RuntimeError\)/
root_caller = /from.*in ['`]middle'/

expect(error.backtrace)
.to match(
Expand Down
5 changes: 4 additions & 1 deletion spec/datadog/tracing/metadata/tagging_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,10 @@
end

it 'does not support it - it sets stringified nested hash as value' do
expect { set_tags }.to change { test_object.get_tag('user') }.from(nil).to('{"id"=>123}')
expected_tag = ['{"id"=>123}', '{"id" => 123}']
expect { set_tags }
.to change { test_object.get_tag('user') }
.from(nil).to(satisfy { |tag| expected_tag.include?(tag) })
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/datadog/tracing/remote_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
it 'sets errored apply state' do
process_config
expect(content.apply_state).to eq(3)
expect(content.apply_error).to match(/Error/) & match(/in process_config/)
expect(content.apply_error).to include('Error') & include('process_config')
end
end

Expand Down

0 comments on commit 761daa4

Please sign in to comment.