Skip to content

Commit

Permalink
Tweak specs to try to avoid flakiness
Browse files Browse the repository at this point in the history
I saw some flakiness in CI, so this is a very soft attempt at avoiding
it; let's see if it's enough or we'll need more changes.
  • Loading branch information
ivoanjo committed Jul 9, 2024
1 parent 5da21c1 commit abdb523
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,8 @@

thread_that_allocates_as_fast_as_possible = Thread.new { loop { BasicObject.new } }

Thread.pass

allocation_samples = try_wait_until do
samples = samples_from_pprof(recorder.serialize!).select { |it| it.values[:'alloc-samples'] > 0 }
samples if samples.any? { |it| it.labels[:'thread name'] == 'Skipped Samples' }
Expand All @@ -557,6 +559,8 @@
thread_that_allocates_as_fast_as_possible.kill
thread_that_allocates_as_fast_as_possible.join

GC.start

cpu_and_wall_time_worker.stop

expect(allocation_samples).to_not be_empty
Expand Down
1 change: 1 addition & 0 deletions spec/datadog/profiling/stack_recorder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ def sample_allocation(obj)
end

before do
GC.start
allocations = [a_string, an_array, "a fearsome interpolated string: #{sample_rate}", (-10..-1).to_a, a_hash,
{ 'z' => -1, 'y' => '-2', 'x' => false }, Object.new]
@num_allocations = 0
Expand Down

0 comments on commit abdb523

Please sign in to comment.