-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added --help documentation for --redis url option for password suppor…
…t for bin/redmon. add --redis url option for load_sim.rb. implemented pending worker tests. reversed ordering of assertions for helpers tests to match rspec actual.should eq(expected) format for proper reporting of failed assertions.
- Loading branch information
James Gorlick
committed
Nov 17, 2013
1 parent
1baa3bd
commit e573df5
Showing
4 changed files
with
64 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,39 @@ | ||
$: << ::File.expand_path("../lib/", __FILE__) | ||
require "rubygems" | ||
require "bundler/setup" | ||
require 'mixlib/cli' | ||
require 'redmon' | ||
require 'redis' | ||
|
||
redis = Redis.connect | ||
class RedmonLoadSimCLI | ||
include Mixlib::CLI | ||
|
||
loop do | ||
start = rand(100000) | ||
multi = rand(5) | ||
start.upto(multi * start) do |i| | ||
redis.set("key-#{i}", "abcdedghijklmnopqrstuvwxyz") | ||
end | ||
option :redis_url, | ||
:short => '-r URL', | ||
:long => '--redis URL', | ||
:default => 'redis://127.0.0.1:6379', | ||
:description => "The Redis url to load simulated traffic against (default: redis://127.0.0.1:6379, note: password is supported, ie redis://:password@127.0.0.1:6379)" | ||
|
||
start.upto(multi * start) do |i| | ||
redis.get("key-#{i}") | ||
redis.del("key-#{i}") | ||
end | ||
end | ||
def run | ||
parse_options | ||
|
||
redis_options = Redis::Client::DEFAULTS || {} | ||
redis_options[:url] = config[:redis_url] if config[:redis_url] | ||
redis = Redis.new(redis_options) | ||
|
||
loop do | ||
start = rand(100000) | ||
multi = rand(5) | ||
start.upto(multi * start) do |i| | ||
redis.set("key-#{i}", "abcdedghijklmnopqrstuvwxyz") | ||
end | ||
|
||
start.upto(multi * start) do |i| | ||
redis.get("key-#{i}") | ||
redis.del("key-#{i}") | ||
end | ||
end | ||
end | ||
end | ||
|
||
RedmonLoadSimCLI.new.run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters