Sha256: 5e200460b0fe4858db1b2bbeff7988ecab7bb3284a0e9cfd3dcb7f4c98ea01fa

Contents?: true

Size: 1.26 KB

Versions: 22

Compression:

Stored size: 1.26 KB

Contents

module Mongo
  module ServerSelection
    module RTT

      # Represents a specification.
      #
      # @since 2.0.0
      class Spec

        # @return [ String ] description The spec description.
        attr_reader :description

        # @return [ Float ] average_rtt The starting average round trip time, in seconds.
        attr_reader :average_rtt

        # @return [ Float ] new_rtt The new round trip time for ismaster, in seconds.
        attr_reader :new_rtt

        # @return [ Float ] new_average_rtt The newly calculated moving average round trip time, in seconds.
        attr_reader :new_average_rtt

        # Instantiate the new spec.
        #
        # @param [ String ] test_path The path to the file.
        #
        # @since 2.0.0
        def initialize(test_path)
          @test = YAML.load(File.read(test_path))
          @description = "#{File.basename(test_path)}: avg_rtt_ms: #{@test['avg_rtt_ms']}, new_rtt_ms: #{@test['new_rtt_ms']}," +
                           " new_avg_rtt: #{@test['new_avg_rtt']}"
          @average_rtt = @test['avg_rtt_ms'] == 'NULL' ? nil : @test['avg_rtt_ms'].to_f / 1000
          @new_rtt = @test['new_rtt_ms'].to_f / 1000
          @new_average_rtt = @test['new_avg_rtt'].to_f / 1000
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
mongo-2.13.3 spec/runners/server_selection_rtt.rb
mongo-2.14.1 spec/runners/server_selection_rtt.rb
mongo-2.15.0.alpha spec/runners/server_selection_rtt.rb
mongo-2.13.2 spec/runners/server_selection_rtt.rb
mongo-2.14.0 spec/runners/server_selection_rtt.rb
mongo-2.14.0.rc1 spec/runners/server_selection_rtt.rb
mongo-2.13.1 spec/runners/server_selection_rtt.rb
mongo-2.12.4 spec/runners/server_selection_rtt.rb
mongo-2.11.6 spec/support/server_selection_rtt.rb
mongo-2.13.0 spec/runners/server_selection_rtt.rb
mongo-2.12.3 spec/runners/server_selection_rtt.rb
mongo-2.13.0.rc1 spec/runners/server_selection_rtt.rb
mongo-2.12.2 spec/runners/server_selection_rtt.rb
mongo-2.11.5 spec/support/server_selection_rtt.rb
mongo-2.13.0.beta1 spec/runners/server_selection_rtt.rb
mongo-2.12.1 spec/runners/server_selection_rtt.rb
mongo-2.12.0.rc0 spec/runners/server_selection_rtt.rb
mongo-2.11.4 spec/support/server_selection_rtt.rb
mongo-2.11.3 spec/support/server_selection_rtt.rb
mongo-2.11.2 spec/support/server_selection_rtt.rb