Sha256: 8cf6c5bd7836335560ec3cd348f4b1711976d6402b5d3bfe72e76fde28541a67
Contents?: true
Size: 1.86 KB
Versions: 2
Compression:
Stored size: 1.86 KB
Contents
# frozen_string_literal: true # encoding: utf-8 require 'spec_helper' describe 'Server' do let(:client) { authorized_client } let(:server) { client.cluster.next_primary } let(:collection) { client['collection'] } let(:view) { Mongo::Collection::View.new(collection) } describe 'operations when client/cluster are disconnected' do shared_examples 'it performs read operations and receives the correct result type' do context 'normal server' do it 'can be used for reads' do result = view.send(:send_initial_query, server) expect(result).to be_a(result_class) end end context 'known server in disconnected cluster' do before do client.close expect(server).not_to be_unknown end it 'can be used for reads' do result = view.send(:send_initial_query, server) expect(result).to be_a(result_class) end end context 'unknown server in disconnected cluster' do before do client.close server.unknown! expect(server).to be_unknown end it 'can be used for reads' do result = view.send(:send_initial_query, server) expect(result).to be_a(result_class) end end end context 'for servers with FCV >= 3.4' do min_server_fcv '3.2' let(:result_class) { Mongo::Operation::Find::Result } it_behaves_like 'it performs read operations and receives the correct result type' end context 'for servers with FCV < 3.4' do # Find command was introduced in server version 3.2, so older versions should # receive legacy result types. max_server_fcv '3.0' let(:result_class) { Mongo::Operation::Find::Legacy::Result } it_behaves_like 'it performs read operations and receives the correct result type' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mongo-2.15.1 | spec/integration/server_spec.rb |
mongo-2.15.0 | spec/integration/server_spec.rb |