Skip to content

Commit

Permalink
di test
Browse files Browse the repository at this point in the history
  • Loading branch information
p committed Aug 26, 2024
1 parent b7f051f commit 1a79e25
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/datadog/di/probe_notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module ProbeNotifier
}
elsif probe.line?
{
lines: {
lines: snapshot && {
probe.line_no => {locals: serializer.serialize_vars(snapshot)},
},
}
Expand Down
3 changes: 2 additions & 1 deletion lib/datadog/di/probe_notifier_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def start

def stop(timeout = 1)
wake.signal
wake.join(timeout)
thread.join(timeout)
end

private
Expand All @@ -53,6 +53,7 @@ def stop(timeout = 1)
attr_reader :status_client
attr_reader :snapshot_client
attr_reader :wake
attr_reader :thread

DIAGNOSTICS_PATH = '/debugger/v1/diagnostics'
INPUT_PATH = '/debugger/v1/input'
Expand Down
10 changes: 7 additions & 3 deletions spec/datadog/di/integration/instrumentation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
require_relative 'instrumentation_integration_test_class'
end

after do
component.shutdown!
end

let(:settings) do
settings = Datadog::Core::Configuration::Settings.new
settings.internal_dynamic_instrumentation.enabled = true
Expand All @@ -14,7 +18,7 @@
end

let(:hook_manager) do
Datadog::DI::HookManager.new(settings)
component.hook_manager
end

let(:defined_probes) do
Expand All @@ -26,8 +30,7 @@
end

let(:remote_processor) do
Datadog::DI::RemoteProcessor.new(
settings, hook_manager, defined_probes, installed_probes)
component.remote_processor
end

let(:agent_settings) do
Expand Down Expand Up @@ -66,6 +69,7 @@

it 'invokes probe' do
remote_processor.process(probe_rc_spec)
expect(Datadog::DI.component.probe_notifier_worker).to receive(:add_snapshot).once.and_call_original
expect(InstrumentationIntegrationTestClass.new.test_method).to eq(42)
end

Expand Down

0 comments on commit 1a79e25

Please sign in to comment.