diff --git a/spec/datadog/core/diagnostics/environment_logger_spec.rb b/spec/datadog/core/diagnostics/environment_logger_spec.rb index ef10c4d2e54..60d3c1996ad 100644 --- a/spec/datadog/core/diagnostics/environment_logger_spec.rb +++ b/spec/datadog/core/diagnostics/environment_logger_spec.rb @@ -298,25 +298,28 @@ end context 'with MRI' do - before { skip unless PlatformHelpers.mri? } + before { skip('Spec only runs on MRI') unless PlatformHelpers.mri? } it { is_expected.to include vm: start_with('ruby') } end context 'with JRuby' do - before { skip unless PlatformHelpers.jruby? } + before { skip('Spec only runs on JRuby') unless PlatformHelpers.jruby? } it { is_expected.to include vm: start_with('jruby') } end context 'with TruffleRuby' do - before { skip unless PlatformHelpers.truffleruby? } + before { skip('Spec only runs on TruffleRuby') unless PlatformHelpers.truffleruby? } it { is_expected.to include vm: start_with('truffleruby') } end context 'with profiling enabled' do - before { Datadog.configure { |c| c.profiling.enabled = true } } + before do + allow_any_instance_of(Datadog::Profiling::Profiler).to receive(:start) if PlatformHelpers.mri? + Datadog.configure { |c| c.profiling.enabled = true } + end it { is_expected.to include profiling_enabled: true } end diff --git a/spec/datadog/core/telemetry/collector_spec.rb b/spec/datadog/core/telemetry/collector_spec.rb index e573a973018..dc5c75c600f 100644 --- a/spec/datadog/core/telemetry/collector_spec.rb +++ b/spec/datadog/core/telemetry/collector_spec.rb @@ -86,6 +86,7 @@ Datadog.configuration.appsec.enabled = false stub_const('Datadog::Core::Environment::Ext::TRACER_VERSION', '4.2') end + after do Datadog.configuration.profiling.send(:reset!) Datadog.configuration.appsec.send(:reset!) @@ -99,11 +100,13 @@ require 'datadog/appsec' before do + allow_any_instance_of(Datadog::Profiling::Profiler).to receive(:start) if PlatformHelpers.mri? Datadog.configure do |c| c.profiling.enabled = true c.appsec.enabled = true end end + after do Datadog.configuration.profiling.send(:reset!) Datadog.configuration.appsec.send(:reset!) @@ -223,6 +226,7 @@ context 'when profiling is enabled' do before do stub_const('Datadog::Core::Environment::Ext::TRACER_VERSION', '4.2') + allow_any_instance_of(Datadog::Profiling::Profiler).to receive(:start) Datadog.configure do |c| c.profiling.enabled = true end diff --git a/spec/datadog/profiling/profiler_spec.rb b/spec/datadog/profiling/profiler_spec.rb index ad00de32242..c511df62032 100644 --- a/spec/datadog/profiling/profiler_spec.rb +++ b/spec/datadog/profiling/profiler_spec.rb @@ -1,6 +1,7 @@ # typed: false require 'spec_helper' +require 'datadog/profiling/spec_helper' require 'datadog/profiling' require 'datadog/profiling/profiler' @@ -8,6 +9,8 @@ require 'datadog/profiling/scheduler' RSpec.describe Datadog::Profiling::Profiler do + before { skip_if_profiling_not_supported(self) } + subject(:profiler) { described_class.new(collectors, scheduler) } let(:collectors) { Array.new(2) { instance_double(Datadog::Profiling::Collectors::OldStack) } }