Sha256: c89dc70409c612c65071fb7ce0f5c205a54e32a93321a1865800ca17b26226fc

Contents?: true

Size: 998 Bytes

Versions: 13

Compression:

Stored size: 998 Bytes

Contents

require 'spec_helper'

module RedisFailover
  class NodeStrategy
    NodeStrategy.for(:consensus)

    describe Consensus do
      let(:node) { Node.new(:host => 'localhost', :port => '123') }
      let(:snapshot) { NodeSnapshot.new(node) }

      describe '#determine_state' do
        it 'returns the unavailable state if unavailable by all node managers' do
          strategy = NodeStrategy.for(:consensus)
          snapshot.unviewable_by('nm1')
          snapshot.unviewable_by('nm2')
          snapshot.unviewable_by('nm3')
          strategy.determine_state(node, node => snapshot).should == :unavailable
        end

        it 'returns the available state if unavailable by some node managers' do
          strategy = NodeStrategy.for(:consensus)
          snapshot.unviewable_by('nm1')
          snapshot.unviewable_by('nm2')
          snapshot.viewable_by('nm3', 0)
          strategy.determine_state(node, node => snapshot).should == :available
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
spbtv_redis_failover-1.0.2.1 spec/node_strategy/consensus_spec.rb
nogara-redis_failover-1.0.6 spec/node_strategy/consensus_spec.rb
nogara-redis_failover-1.0.5 spec/node_strategy/consensus_spec.rb
nogara-redis_failover-1.0.4 spec/node_strategy/consensus_spec.rb
redis_failover-1.0.2 spec/node_strategy/consensus_spec.rb
nogara-redis_failover-1.0.2 spec/node_strategy/consensus_spec.rb
nogara-redis_failover-1.0.1 spec/node_strategy/consensus_spec.rb
redis_failover-1.0.1 spec/node_strategy/consensus_spec.rb
nogara-redis_failover-1.0.0 spec/node_strategy/consensus_spec.rb
redis_failover-1.0.0 spec/node_strategy/consensus_spec.rb
nogara-redis_failover-0.9.7.4 spec/node_strategy/consensus_spec.rb
nogara-redis_failover-0.9.7.3 spec/node_strategy/consensus_spec.rb
nogara-redis_failover-0.9.7.2 spec/node_strategy/consensus_spec.rb