Sha256: ad4cdd4c668d407ae77fb55cad5b04c1768b2e07d5c227b38c9239dfcac3f56e

Contents?: true

Size: 1.09 KB

Versions: 48

Compression:

Stored size: 1.09 KB

Contents

$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require './test/replica_sets/rs_test_helper'

class ComplexConnectTest < Test::Unit::TestCase
  
  def setup
    ensure_rs
  end

  def teardown
    @rs.restart_killed_nodes
    @conn.close if defined?(@conn) && @conn
  end

  def test_complex_connect
    primary = Connection.new(@rs.host, @rs.ports[0])

    @conn = ReplSetConnection.new([
      "#{@rs.host}:#{@rs.ports[2]}",
      "#{@rs.host}:#{@rs.ports[1]}",
      "#{@rs.host}:#{@rs.ports[0]}",
    ])

    @conn['test']['foo'].insert({:a => 1})
    assert @conn['test']['foo'].find_one

    config = primary['local']['system.replset'].find_one
    config['version'] += 1
    config['members'].delete_if do |member|
      member['host'].include?(@rs.ports[2].to_s)
    end

    assert_raise ConnectionFailure do
      primary['admin'].command({:replSetReconfig => config})
    end
    @rs.ensure_up
    assert_raise ConnectionFailure do
      primary['admin'].command({:replSetStepDown => 1})
    end

    rescue_connection_failure do
      assert @conn['test']['foo'].find_one
    end
  end
end

Version data entries

48 entries across 48 versions & 2 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/mongo-1.6.2/test/replica_sets/complex_connect_test.rb
classiccms-0.7.4 vendor/bundle/gems/mongo-1.6.2/test/replica_sets/complex_connect_test.rb
classiccms-0.7.3 vendor/bundle/gems/mongo-1.6.2/test/replica_sets/complex_connect_test.rb
classiccms-0.7.2 vendor/bundle/gems/mongo-1.6.2/test/replica_sets/complex_connect_test.rb
classiccms-0.7.1 vendor/bundle/gems/mongo-1.6.2/test/replica_sets/complex_connect_test.rb
classiccms-0.7.0 vendor/bundle/gems/mongo-1.6.2/test/replica_sets/complex_connect_test.rb
classiccms-0.6.9 vendor/bundle/gems/mongo-1.6.2/test/replica_sets/complex_connect_test.rb
classiccms-0.6.8 vendor/bundle/gems/mongo-1.6.2/test/replica_sets/complex_connect_test.rb
classiccms-0.6.7 vendor/bundle/gems/mongo-1.6.2/test/replica_sets/complex_connect_test.rb
classiccms-0.6.6 vendor/bundle/gems/mongo-1.6.2/test/replica_sets/complex_connect_test.rb
classiccms-0.6.5 vendor/bundle/gems/mongo-1.6.2/test/replica_sets/complex_connect_test.rb
classiccms-0.6.4 vendor/bundle/gems/mongo-1.6.2/test/replica_sets/complex_connect_test.rb
classiccms-0.6.3 vendor/bundle/gems/mongo-1.6.2/test/replica_sets/complex_connect_test.rb
classiccms-0.6.2 vendor/bundle/gems/mongo-1.6.2/test/replica_sets/complex_connect_test.rb
classiccms-0.6.1 vendor/bundle/gems/mongo-1.6.2/test/replica_sets/complex_connect_test.rb
classiccms-0.6.0 vendor/bundle/gems/mongo-1.6.2/test/replica_sets/complex_connect_test.rb
classiccms-0.5.17 vendor/bundle/gems/mongo-1.6.2/test/replica_sets/complex_connect_test.rb
classiccms-0.5.16 vendor/bundle/gems/mongo-1.6.2/test/replica_sets/complex_connect_test.rb
classiccms-0.5.15 vendor/bundle/gems/mongo-1.6.2/test/replica_sets/complex_connect_test.rb
classiccms-0.5.14 vendor/bundle/gems/mongo-1.6.2/test/replica_sets/complex_connect_test.rb