diff --git a/spec/datadog/profiling/crashtracker_spec.rb b/spec/datadog/profiling/crashtracker_spec.rb index 77879652454..6f5c5137925 100644 --- a/spec/datadog/profiling/crashtracker_spec.rb +++ b/spec/datadog/profiling/crashtracker_spec.rb @@ -100,13 +100,15 @@ it 'starts a second crash tracker for the fork' do expect_in_fork do + wait_for { `pgrep -f libdatadog-crashtracking-receiver`.lines.size }.to be 1 + crashtracker.reset_after_fork - expect(`pgrep -f libdatadog-crashtracking-receiver`.lines.size).to be 2 + wait_for { `pgrep -f libdatadog-crashtracking-receiver`.lines.size }.to be 2 crashtracker.stop - expect(`pgrep -f libdatadog-crashtracking-receiver`.lines.size).to be 1 + wait_for { `pgrep -f libdatadog-crashtracking-receiver`.lines.size }.to be 1 end end end