diff --git a/.github/workflows/test-macos.yaml b/.github/workflows/test-macos.yaml index 50b47fdfd7e..ef24498f43f 100644 --- a/.github/workflows/test-macos.yaml +++ b/.github/workflows/test-macos.yaml @@ -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 }} @@ -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 diff --git a/.github/workflows/test-yjit.yaml b/.github/workflows/test-yjit.yaml index b9ce09fbda3..5b0a6c4809f 100644 --- a/.github/workflows/test-yjit.yaml +++ b/.github/workflows/test-yjit.yaml @@ -10,6 +10,7 @@ jobs: ruby: - '3.2' - '3.3' + - '3.4' # ADD NEW RUBIES HERE rubyopt: - '--yjit' diff --git a/spec/datadog/core/environment/execution_spec.rb b/spec/datadog/core/environment/execution_spec.rb index 0324384c511..4595715886e 100644 --- a/spec/datadog/core/environment/execution_spec.rb +++ b/spec/datadog/core/environment/execution_spec.rb @@ -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 diff --git a/spec/datadog/core/error_spec.rb b/spec/datadog/core/error_spec.rb index 93858a81045..3120bf417b2 100644 --- a/spec/datadog/core/error_spec.rb +++ b/spec/datadog/core/error_spec.rb @@ -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( diff --git a/spec/datadog/tracing/metadata/tagging_spec.rb b/spec/datadog/tracing/metadata/tagging_spec.rb index 113c9aaab7d..6ec3c633937 100644 --- a/spec/datadog/tracing/metadata/tagging_spec.rb +++ b/spec/datadog/tracing/metadata/tagging_spec.rb @@ -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 diff --git a/spec/datadog/tracing/remote_spec.rb b/spec/datadog/tracing/remote_spec.rb index 5755a1903e3..48bae546b89 100644 --- a/spec/datadog/tracing/remote_spec.rb +++ b/spec/datadog/tracing/remote_spec.rb @@ -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