test/lib/worker_test.rb in sidekiq-benchmark-0.4.1 vs test/lib/worker_test.rb in sidekiq-benchmark-0.5.0
- old
+ new
@@ -31,38 +31,36 @@
assert_in_delta metrics[:continued_metric], 2, 0.2
end
it "should save metrics to redis" do
Sidekiq.redis do |conn|
- total_time = conn.hget("#{@worker.benchmark.redis_key}:total", :job_time)
+ total_time = conn.hget(@worker.benchmark.redis_keys[:total], :job_time)
total_time.wont_be_nil
- metrics = conn.hkeys("#{@worker.benchmark.redis_key}:stats")
+ metrics = conn.hkeys(@worker.benchmark.redis_keys[:stats])
metrics.wont_be_empty
end
end
it "should collect metrics with alter syntax" do
worker = AlterWorkerMock.new
metrics = worker.benchmark.metrics
Sidekiq.redis do |conn|
- metric_set = conn.hkeys("#{worker.benchmark.redis_key}:stats")
+ metric_set = conn.hkeys(worker.benchmark.redis_keys[:stats])
metric_set.must_be_empty
end
worker.metric_names.each do |metric_name|
metrics[metric_name].wont_be_nil
end
worker.benchmark.finish_time.must_be_nil
-
worker.finish
-
worker.benchmark.finish_time.wont_be_nil
Sidekiq.redis do |conn|
- metric_set = conn.hkeys("#{worker.benchmark.redis_key}:stats")
+ metric_set = conn.hkeys(worker.benchmark.redis_keys[:stats])
metric_set.wont_be_empty
end
end
it "should allow benchmark methods" do