Sha256: 9ba44796937d27476418e9b19ba7c45466f2aa465b99b2126b213abeca0d29bb

Contents?: true

Size: 814 Bytes

Versions: 10

Compression:

Stored size: 814 Bytes

Contents

require 'spec_helper'

require 'runners/server_selection_rtt'

describe 'Server Selection moving average round trip time calculation' do

  include Mongo::ServerSelection::RTT

  SERVER_SELECTION_RTT_TESTS.each do |file|

    spec = Mongo::ServerSelection::RTT::Spec.new(file)

    context(spec.description) do

      let(:averager) do
        Mongo::Server::RoundTripTimeAverager.new
      end

      before do
        averager.instance_variable_set(:@average_round_trip_time, spec.average_rtt)
        averager.instance_variable_set(:@last_round_trip_time, spec.new_rtt)
        averager.send(:update_average_round_trip_time)
      end

      it 'correctly calculates the moving average round trip time' do
        expect(averager.average_round_trip_time).to eq(spec.new_average_rtt)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mongo-2.13.3 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.14.1 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.15.0.alpha spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.13.2 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.14.0 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.14.0.rc1 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.13.1 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.13.0 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.13.0.rc1 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.13.0.beta1 spec/spec_tests/server_selection_rtt_spec.rb