Sha256: 720f1a4be984cfc0f6963d858fb7f19693fb15d56d81bf096e35cb33f562cc42
Contents?: true
Size: 1.66 KB
Versions: 3
Compression:
Stored size: 1.66 KB
Contents
require 'spec_helper' describe Mongo::Cluster::Topology::Sharded do let(:address) do Mongo::Address.new('127.0.0.1:27017') end let(:topology) do described_class.new({}) end describe '.servers' do let(:mongos) do Mongo::Server.new(address, Mongo::Event::Listeners.new, TEST_OPTIONS) end let(:standalone) do Mongo::Server.new(address, Mongo::Event::Listeners.new, TEST_OPTIONS) end let(:replica_set) do Mongo::Server.new(address, Mongo::Event::Listeners.new, TEST_OPTIONS) end let(:mongos_description) do Mongo::Server::Description.new(address, { 'msg' => 'isdbgrid' }) end let(:standalone_description) do Mongo::Server::Description.new(address, { 'ismaster' => true }) end let(:replica_set_description) do Mongo::Server::Description.new(address, { 'ismaster' => true, 'setName' => 'testing' }) end before do mongos.monitor.instance_variable_set(:@description, mongos_description) standalone.monitor.instance_variable_set(:@description, standalone_description) replica_set.monitor.instance_variable_set(:@description, replica_set_description) end let(:servers) do topology.servers([ mongos, standalone, replica_set ]) end it 'returns only mongos servers' do expect(servers).to eq([ mongos ]) end end describe '.replica_set?' do it 'returns false' do expect(topology).to_not be_replica_set end end describe '.sharded?' do it 'returns true' do expect(topology).to be_sharded end end describe '.single?' do it 'returns false' do expect(topology).to_not be_single end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mongo-2.0.5 | spec/mongo/cluster/topology/sharded_spec.rb |
mongo-2.0.4 | spec/mongo/cluster/topology/sharded_spec.rb |
mongo-2.0.3 | spec/mongo/cluster/topology/sharded_spec.rb |