Sha256: 60c9608ec9ae1ca06161cede913ff308aedb953cbae2a46cfe9419278e163a45
Contents?: true
Size: 1.67 KB
Versions: 2
Compression:
Stored size: 1.67 KB
Contents
require 'spec_helper' module RedisFailover describe CLI do describe '.parse' do it 'properly parses redis nodes' do opts = CLI.parse(['-n host1:1,host2:2,host3:3', '-z localhost:1111']) opts[:nodes].should == [ {:host => 'host1', :port => '1'}, {:host => 'host2', :port => '2'}, {:host => 'host3', :port => '3'} ] end it 'properly parses ZooKeeper servers' do opts = CLI.parse(['-n host1:1,host2:2,host3:3', '-z localhost:1111']) opts[:zkservers].should == 'localhost:1111' end it 'properly parses a redis password' do opts = CLI.parse(['-n host:port', '-z localhost:1111', '-p redis_pass']) opts[:nodes].should == [{ :host => 'host', :port => 'port', :password => 'redis_pass' }] end it 'properly parses max node failures' do opts = CLI.parse([ '-n host:port', '-z localhost:1111', '-p redis_pass', '--max-failures', '1']) opts[:max_failures].should == 1 end it 'properly parses the config file' do opts = CLI.parse(['-C', "#{File.dirname(__FILE__)}/support/config/single_environment.yml"]) opts[:zkservers].should == 'zk01:2181,zk02:2181,zk03:2181' opts = CLI.parse(['-C', "#{File.dirname(__FILE__)}/support/config/multiple_environments.yml", '-E', 'development']) opts[:zkservers].should == 'localhost:2181' opts = CLI.parse(['-C', "#{File.dirname(__FILE__)}/support/config/multiple_environments.yml", '-E', 'staging']) opts[:zkservers].should == 'zk01:2181,zk02:2181,zk03:2181' end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
redis_failover-0.8.5 | spec/cli_spec.rb |
redis_failover-0.8.4 | spec/cli_spec.rb |