Skip to content

Commit

Permalink
Allow vegeta args to be passed to shared example
Browse files Browse the repository at this point in the history
The VegetaHelper already allows a hash of additional CLI arguments to be
passed on. Allowing individual tests to modify the duration or rate of
requests. This reinstates that ability by allowing a hash to be passed to
the shared example, which defaults to `{}`.
  • Loading branch information
dcarley committed Nov 7, 2013
1 parent 1a0562b commit 3515425
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions spec/performance_spec.rb
Expand Up @@ -3,11 +3,13 @@
describe "performance" do
ROUTER_LATENCY_THRESHOLD = 20_000_000 # 20 miliseconds in nanoseconds

shared_examples "a performant router" do
shared_examples "a performant router" do |vegeta_opts|
vegeta_opts ||= {}

it "should not significantly increase latency" do
results_direct = results_router = nil
t1 = Thread.new { results_direct = vegeta_request_stats(["http://localhost:3160/one", "http://localhost:3161/two"]) }
t2 = Thread.new { results_router = vegeta_request_stats([router_url("/one"), router_url("/two")]) }
t1 = Thread.new { results_direct = vegeta_request_stats(["http://localhost:3160/one", "http://localhost:3161/two"], vegeta_opts) }
t2 = Thread.new { results_router = vegeta_request_stats([router_url("/one"), router_url("/two")], vegeta_opts) }
t1.join
t2.join

Expand Down

0 comments on commit 3515425

Please sign in to comment.