Sha256: bf2af83c51e9171cd4cb296f4fe6cefa8222ec9c959024011174cd156847467c

Contents?: true

Size: 1.05 KB

Versions: 9

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true
# rubocop:todo all

require 'spec_helper'

describe 'Server selection' do
  context 'replica set' do
    require_topology :replica_set
    # 2.6 server does not provide replSetGetConfig and hence we cannot add
    # the tags to the members.
    min_server_version '3.0'

    context 'when mixed case tag names are used' do
      # For simplicity this test assumes our Evergreen configuration:
      # nodes are started from port 27017 onwards and there are more than
      # one of them.

      let(:desired_index) do
        if authorized_client.cluster.next_primary.address.port == 27017
          1
        else
          0
        end
      end

      let(:client) do
        new_local_client(SpecConfig.instance.addresses,
          SpecConfig.instance.authorized_test_options.merge(
            server_selection_timeout: 4,
            read: {mode: :secondary, tag_sets: [nodeIndex: desired_index.to_s]},
          ))
      end

      it 'selects the server' do
        client['nonexistent'].count.should == 0
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
mongo-2.21.0 spec/integration/server_selection_spec.rb
mongo-2.20.1 spec/integration/server_selection_spec.rb
mogno-2.20.0 spec/integration/server_selection_spec.rb
mogno-1.0.0 spec/integration/server_selection_spec.rb
mongo-2.20.0 spec/integration/server_selection_spec.rb
mongo-2.19.3 spec/integration/server_selection_spec.rb
mongo-2.19.2 spec/integration/server_selection_spec.rb
mongo-2.19.1 spec/integration/server_selection_spec.rb
mongo-2.19.0 spec/integration/server_selection_spec.rb