Skip to content

Commit

Permalink
Harden the test against flickering.
Browse files Browse the repository at this point in the history
I found it was passing in isolation but failing
when run with the whole suite, depending on when
it runs.  It's best to make it relative to the
current memory usage of the process.
  • Loading branch information
myronmarston committed Nov 11, 2013
1 parent 97eadfd commit 5db20ba
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions spec/integration/middleware/memory_usage_monitor_spec.rb
Expand Up @@ -64,15 +64,15 @@ def self.puts(msg)

stub_const('BloatedJobClass', bloated_job_class)

[25, 60, 25].each do |target_mb|
queue.put(BloatedJobClass, { target: target_mb * (1_000) })
max_memory = (MemoryUsageMonitor.current_usage_in_kb * 1.5).to_i

[(max_memory / 2), (max_memory * 1.1).to_i, (max_memory / 2)].each do |target|
queue.put(BloatedJobClass, { target: target })
end

job_records = []

worker.extend(Qless::Middleware::MemoryUsageMonitor.new(
max_memory: 50_000
))
worker.extend(MemoryUsageMonitor.new(max_memory: max_memory))

run_worker_concurrently_with(worker) do
3.times do
Expand Down

0 comments on commit 5db20ba

Please sign in to comment.