Sha256: f5febeb9cc1a0d7805f65a4aa2dc7342669a1a600b5bea3f5f72a397668d50ad

Contents?: true

Size: 863 Bytes

Versions: 18

Compression:

Stored size: 863 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

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

18 entries across 18 versions & 1 rubygems

Version Path
mongo-2.16.4 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.17.4 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.18.3 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.18.2 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.17.3 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.18.1 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.18.0 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.17.2 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.16.3 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.18.0.beta1 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.16.2 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.17.1 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.16.1 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.17.0 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.16.0 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.15.1 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.16.0.alpha1 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.15.0 spec/spec_tests/server_selection_rtt_spec.rb