test/test_redis-stat.rb in redis-stat-0.1.4 vs test/test_redis-stat.rb in redis-stat-0.2.0

- old
+ new

@@ -41,48 +41,43 @@ options = RedisStat::Option.parse([]) assert_equal RedisStat::Option::DEFAULT.sort, options.sort options = RedisStat::Option.parse(%w[localhost:1000 20]) assert_equal({ - :host => 'localhost', - :port => 1000, + :hosts => ['localhost:1000'], :interval => 20, :count => nil, :csv => nil }.sort, options.sort) options = RedisStat::Option.parse(%w[localhost:1000 20 30]) assert_equal({ - :host => 'localhost', - :port => 1000, + :hosts => ['localhost:1000'], :interval => 20, :count => 30, :csv => nil }.sort, options.sort) options = RedisStat::Option.parse(%w[20]) assert_equal({ - :host => '127.0.0.1', - :port => 6379, + :hosts => ['127.0.0.1:6379'], :interval => 20, :count => nil, :csv => nil }.sort, options.sort) options = RedisStat::Option.parse(%w[20 30]) assert_equal({ - :host => '127.0.0.1', - :port => 6379, + :hosts => ['127.0.0.1:6379'], :interval => 20, :count => 30, :csv => nil }.sort, options.sort) options = RedisStat::Option.parse(%w[localhost:8888 10 --csv=/tmp/a.csv]) assert_equal({ - :port => 8888, - :host => 'localhost', + :hosts => ['localhost:8888'], :interval => 10, :count => nil, :csv => '/tmp/a.csv', }.sort, options.sort) end @@ -99,10 +94,10 @@ end def test_start csv = '/tmp/redis-stat.csv' cnt = 50 - rs = RedisStat.new :interval => 0.01, :count => cnt, :verbose => true, :csv => csv + rs = RedisStat.new :hosts => %w[localhost] * 5, :interval => 0.1, :count => cnt, :verbose => true, :csv => csv rs.start $stdout assert_equal cnt + 1, File.read(csv).lines.to_a.length ensure File.unlink csv