Sha256: 34d7c2d51268ab5e7cf3d036cdd6501aa135e1e034b8aab890d6d99f774dfc00

Contents?: true

Size: 864 Bytes

Versions: 8

Compression:

Stored size: 864 Bytes

Contents

# frozen_string_literal: true
# rubocop:todo all

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

8 entries across 8 versions & 2 rubygems

Version Path
mongo-2.20.1 spec/spec_tests/server_selection_rtt_spec.rb
mogno-2.20.0 spec/spec_tests/server_selection_rtt_spec.rb
mogno-1.0.0 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.20.0 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.19.3 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.19.2 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.19.1 spec/spec_tests/server_selection_rtt_spec.rb
mongo-2.19.0 spec/spec_tests/server_selection_rtt_spec.rb