From 8bc0e5e6914b180bbafcb8b09fd412b0bfd93ed2 Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Wed, 9 Oct 2024 16:26:59 +0200 Subject: [PATCH] Removing problematic crashtracker specs These specs are problematic in two ways: - `pgrep` results in false positive - the above masked the fact that `at_fork` appears to be unreliable - some of these leak threads --- .../core/crashtracking/component_spec.rb | 110 ------------------ 1 file changed, 110 deletions(-) diff --git a/spec/datadog/core/crashtracking/component_spec.rb b/spec/datadog/core/crashtracking/component_spec.rb index c52b88572fe..9fc7224ea02 100644 --- a/spec/datadog/core/crashtracking/component_spec.rb +++ b/spec/datadog/core/crashtracking/component_spec.rb @@ -97,13 +97,6 @@ end context 'instance methods' do - # No crash tracker process should still be running at the start of each testcase - around do |example| - wait_for { `pgrep -f libdatadog-crashtracking-receiver` }.to be_empty - example.run - wait_for { `pgrep -f libdatadog-crashtracking-receiver` }.to be_empty - end - describe '#start' do context 'when _native_start_or_update_on_fork raises an exception' do it 'logs the exception' do @@ -116,56 +109,6 @@ crashtracker.start end end - - it 'starts the crash tracker' do - crashtracker = build_crashtracker - - crashtracker.start - - wait_for { `pgrep -f libdatadog-crashtracking-receiver` }.to_not be_empty - - tear_down! - end - - context 'when calling start multiple times in a row' do - it 'only starts the crash tracker once' do - crashtracker = build_crashtracker - - 3.times { crashtracker.start } - - wait_for { `pgrep -f libdatadog-crashtracking-receiver`.lines.size }.to be 1 - - tear_down! - end - end - - context 'when multiple instances' do - it 'only starts the crash tracker once' do - crashtracker = build_crashtracker - crashtracker.start - - another_crashtracker = build_crashtracker - another_crashtracker.start - - wait_for { `pgrep -f libdatadog-crashtracking-receiver`.lines.size }.to be 1 - - tear_down! - end - end - - context 'when forked' do - it 'starts a second crash tracker for the fork' do - crashtracker = build_crashtracker - - crashtracker.start - - expect_in_fork do - wait_for { `pgrep -f libdatadog-crashtracking-receiver`.lines.size }.to be 2 - end - - tear_down! - end - end end describe '#stop' do @@ -180,18 +123,6 @@ crashtracker.stop end end - - it 'stops the crash tracker' do - crashtracker = build_crashtracker - - crashtracker.start - - wait_for { `pgrep -f libdatadog-crashtracking-receiver`.lines.size }.to eq 1 - - crashtracker.stop - - wait_for { `pgrep -f libdatadog-crashtracking-receiver` }.to be_empty - end end describe '#update_on_fork' do @@ -216,17 +147,6 @@ crashtracker.update_on_fork end - - it 'updates existing crash tracking process after started' do - crashtracker = build_crashtracker - - crashtracker.start - crashtracker.update_on_fork - - wait_for { `pgrep -f libdatadog-crashtracking-receiver`.lines.size }.to be 1 - - tear_down! - end end context 'integration testing' do @@ -360,36 +280,6 @@ expect(crash_report_message[:os_info]).to_not be_empty end end - - context 'when forked' do - # This integration test coverages the case that - # the callback registered with `Utils::AtForkMonkeyPatch.at_fork` - # does not contain a stale instance of the crashtracker component. - it 'ensures the latest configuration applied' do - allow(described_class).to receive(:_native_start_or_update_on_fork) - - # `Datadog.configure` to trigger crashtracking component reinstantiation, - # a callback is first registered with `Utils::AtForkMonkeyPatch.at_fork`, - # but not with the second `Datadog.configure` invokation. - Datadog.configure do |c| - c.agent.host = 'example.com' - end - - Datadog.configure do |c| - c.agent.host = 'google.com' - c.agent.port = 12345 - end - - expect_in_fork do - expect(described_class).to have_received(:_native_start_or_update_on_fork).with( - hash_including( - action: :update_on_fork, - agent_base_url: 'http://google.com:12345/', - ) - ) - end - end - end end end