Sha256: c4d20794100bc8d166c82aee81460f9633923fefc406d572212e108d19b414d0

Contents?: true

Size: 641 Bytes

Versions: 9

Compression:

Stored size: 641 Bytes

Contents

$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require './test/test_helper'
require './test/tools/repl_set_manager'

unless defined? RS
  RS = ReplSetManager.new
  RS.start_set
end

class Test::Unit::TestCase

  # Generic code for rescuing connection failures and retrying operations.
  # This could be combined with some timeout functionality.
  def rescue_connection_failure(max_retries=60)
    retries = 0
    begin
      yield
    rescue Mongo::ConnectionFailure => ex
      puts "Rescue attempt #{retries}: from #{ex}"
      retries += 1
      raise ex if retries > max_retries
      sleep(1)
      retry
    end
  end

end

Version data entries

9 entries across 9 versions & 4 rubygems

Version Path
vanity-1.7.1 vendor/ruby/1.9.1/gems/mongo-1.3.1/test/replica_sets/rs_test_helper.rb
jonbell-mongo-1.3.1.2 test/replica_sets/rs_test_helper.rb
mongo-lyon-1.2.4 test/replica_sets/rs_test_helper.rb
mongo-1.3.1 test/replica_sets/rs_test_helper.rb
mongo-1.3.0 test/replica_sets/rs_test_helper.rb
mongo-1.3.0.rc0 test/replica_sets/rs_test_helper.rb
mongo-1.2.4 test/replica_sets/rs_test_helper.rb
mongo-1.2.3 test/replica_sets/rs_test_helper.rb
mongo-1.2.2 test/replica_sets/rs_test_helper.rb