Sha256: 91625ecd71575049b68c295eefcaa3a6a29a56faa18878e0faa561525cc23ffd

Contents?: true

Size: 844 Bytes

Versions: 9

Compression:

Stored size: 844 Bytes

Contents

# frozen_string_literal: true
# rubocop:todo all

require 'spec_helper'

describe 'awaited hello' do
  min_server_fcv '4.4'

  # If we send the consecutive hello commands to different mongoses,
  # they have different process ids, and so the awaited one would return
  # immediately.
  require_no_multi_mongos

  let(:client) { authorized_client }

  it 'waits' do
    # Perform a regular hello to get topology version
    resp = client.database.command(hello: 1)
    doc = resp.replies.first.documents.first
    tv = Mongo::TopologyVersion.new(doc['topologyVersion'])
    tv.should be_a(BSON::Document)

    elapsed_time = Benchmark.realtime do
      resp = client.database.command(hello: 1,
        topologyVersion: tv.to_doc, maxAwaitTimeMS: 500)
    end
    doc = resp.replies.first.documents.first

    elapsed_time.should > 0.5
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

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