Skip to content

Commit

Permalink
[PROF-8667] Split profiling tests into ractor and non-ractor suites.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexJF committed Dec 12, 2023
1 parent fdca793 commit 3c4f242
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
29 changes: 29 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ TEST_METADATA = {
'appsec:main' => {
'' => '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby'
},
'profiling:main' => {
'' => '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby'
},
'profiling:ractors' => {
'' => '❌ 2.1 / ❌ 2.2 / ❌ 2.3 / ❌ 2.4 / ❌ 2.5 / ❌ 2.6 / ❌ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby'
},
'contrib' => {
'' => '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby'
},
Expand Down Expand Up @@ -535,6 +541,29 @@ namespace :spec do
end

task appsec: [:'appsec:all']

namespace :profiling do
task all: [:main, :ractors]

# Datadog Profiling main specs without Ractor creation
# NOTE: Ractor creation will transition the entire Ruby VM into multi-ractor mode. This cannot be undone
# and, as such, may introduce side-effects between tests and make them flaky depending on order of
# execution. By splitting in two separate suites, the side-effect impact should be mitigated as
# the non-ractor VM will never trigger the transition into multi-ractor mode.
desc '' # "Explicitly hiding from `rake -T`"
RSpec::Core::RakeTask.new(:main) do |t, args|
t.pattern = 'spec/datadog/profiling/**/*_spec.rb'
t.rspec_opts = [*args.to_a, '-t ~ractors'].join(' ')
end

desc '' # "Explicitly hiding from `rake -T`"
RSpec::Core::RakeTask.new(:ractors) do |t, args|
t.pattern = 'spec/datadog/profiling/**/*_spec.rb'
t.rspec_opts = [*args.to_a, '-t ractors'].join(' ')
end
end

task profiling: [:'profiling:all']
end

if defined?(RuboCop::RakeTask)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@
end
end

context 'when called from a background ractor' do
context 'when called from a background ractor', :ractors => true do
# Even though we're not testing it explicitly, the GC profiling hooks can sometimes be called when running these
# specs. Unfortunately, there's a VM crash in that case as well -- https://bugs.ruby-lang.org/issues/18464 --
# so this must be disabled when interacting with Ractors.
Expand Down
2 changes: 1 addition & 1 deletion spec/datadog/profiling/native_extension_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
it { is_expected.to be true }
end

context 'on a background Ractor' do
context 'on a background Ractor', :ractors => true do
# @ivoanjo: When we initially added this test, our test suite kept deadlocking in CI in a later test (not on
# this one).
#
Expand Down

0 comments on commit 3c4f242

Please sign in to comment.