minor: fix for replica set tests -- each TestCase class now gets a new replica set
This commit is contained in:
parent
eb715313a2
commit
7d5ab886ed
@ -2,50 +2,53 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|||||||
require './test/replica_sets/rs_test_helper'
|
require './test/replica_sets/rs_test_helper'
|
||||||
|
|
||||||
class BasicTest < Test::Unit::TestCase
|
class BasicTest < Test::Unit::TestCase
|
||||||
include ReplicaSetTest
|
|
||||||
|
def setup
|
||||||
|
ensure_rs
|
||||||
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
self.rs.restart_killed_nodes
|
@rs.restart_killed_nodes
|
||||||
@conn.close if defined?(@conn) && @conn
|
@conn.close if defined?(@conn) && @conn
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_connect
|
def test_connect
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[1]], [self.rs.host, self.rs.ports[0]],
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[1]], [@rs.host, @rs.ports[0]],
|
||||||
[self.rs.host, self.rs.ports[2]], :name => self.rs.name)
|
[@rs.host, @rs.ports[2]], :name => @rs.name)
|
||||||
assert @conn.connected?
|
assert @conn.connected?
|
||||||
|
|
||||||
assert_equal self.rs.primary, @conn.primary
|
assert_equal @rs.primary, @conn.primary
|
||||||
assert_equal self.rs.secondaries.sort, @conn.secondaries.sort
|
assert_equal @rs.secondaries.sort, @conn.secondaries.sort
|
||||||
assert_equal self.rs.arbiters.sort, @conn.arbiters.sort
|
assert_equal @rs.arbiters.sort, @conn.arbiters.sort
|
||||||
|
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[1]], [self.rs.host, self.rs.ports[0]],
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[1]], [@rs.host, @rs.ports[0]],
|
||||||
:name => self.rs.name)
|
:name => @rs.name)
|
||||||
assert @conn.connected?
|
assert @conn.connected?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_cache_original_seed_nodes
|
def test_cache_original_seed_nodes
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[1]], [self.rs.host, self.rs.ports[0]],
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[1]], [@rs.host, @rs.ports[0]],
|
||||||
[self.rs.host, self.rs.ports[2]], [self.rs.host, 19356], :name => self.rs.name)
|
[@rs.host, @rs.ports[2]], [@rs.host, 19356], :name => @rs.name)
|
||||||
assert @conn.connected?
|
assert @conn.connected?
|
||||||
assert @conn.seeds.include?([self.rs.host, 19356]), "Original seed nodes not cached!"
|
assert @conn.seeds.include?([@rs.host, 19356]), "Original seed nodes not cached!"
|
||||||
assert_equal [self.rs.host, 19356], @conn.seeds.last, "Original seed nodes not cached!"
|
assert_equal [@rs.host, 19356], @conn.seeds.last, "Original seed nodes not cached!"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_accessors
|
def test_accessors
|
||||||
seeds = [[self.rs.host, self.rs.ports[0]], [self.rs.host, self.rs.ports[1]],
|
seeds = [[@rs.host, @rs.ports[0]], [@rs.host, @rs.ports[1]],
|
||||||
[self.rs.host, self.rs.ports[2]]]
|
[@rs.host, @rs.ports[2]]]
|
||||||
args = seeds << {:name => self.rs.name}
|
args = seeds << {:name => @rs.name}
|
||||||
@conn = ReplSetConnection.new(*args)
|
@conn = ReplSetConnection.new(*args)
|
||||||
|
|
||||||
assert_equal @conn.host, self.rs.primary[0]
|
assert_equal @conn.host, @rs.primary[0]
|
||||||
assert_equal @conn.port, self.rs.primary[1]
|
assert_equal @conn.port, @rs.primary[1]
|
||||||
assert_equal @conn.host, @conn.primary_pool.host
|
assert_equal @conn.host, @conn.primary_pool.host
|
||||||
assert_equal @conn.port, @conn.primary_pool.port
|
assert_equal @conn.port, @conn.primary_pool.port
|
||||||
assert_equal @conn.nodes.sort, @conn.seeds.sort
|
assert_equal @conn.nodes.sort, @conn.seeds.sort
|
||||||
assert_equal 2, @conn.secondaries.length
|
assert_equal 2, @conn.secondaries.length
|
||||||
assert_equal 0, @conn.arbiters.length
|
assert_equal 0, @conn.arbiters.length
|
||||||
assert_equal 2, @conn.secondary_pools.length
|
assert_equal 2, @conn.secondary_pools.length
|
||||||
assert_equal self.rs.name, @conn.replica_set_name
|
assert_equal @rs.name, @conn.replica_set_name
|
||||||
assert @conn.secondary_pools.include?(@conn.read_pool)
|
assert @conn.secondary_pools.include?(@conn.read_pool)
|
||||||
assert_equal 5, @conn.tag_map.keys.length
|
assert_equal 5, @conn.tag_map.keys.length
|
||||||
assert_equal 90, @conn.refresh_interval
|
assert_equal 90, @conn.refresh_interval
|
||||||
@ -55,9 +58,9 @@ class BasicTest < Test::Unit::TestCase
|
|||||||
context "Socket pools" do
|
context "Socket pools" do
|
||||||
context "checking out writers" do
|
context "checking out writers" do
|
||||||
setup do
|
setup do
|
||||||
seeds = [[self.rs.host, self.rs.ports[0]], [self.rs.host, self.rs.ports[1]],
|
seeds = [[@rs.host, @rs.ports[0]], [@rs.host, @rs.ports[1]],
|
||||||
[self.rs.host, self.rs.ports[2]]]
|
[@rs.host, @rs.ports[2]]]
|
||||||
args = seeds << {:name => self.rs.name}
|
args = seeds << {:name => @rs.name}
|
||||||
@con = ReplSetConnection.new(*args)
|
@con = ReplSetConnection.new(*args)
|
||||||
@coll = @con[MONGO_TEST_DB]['test-connection-exceptions']
|
@coll = @con[MONGO_TEST_DB]['test-connection-exceptions']
|
||||||
end
|
end
|
||||||
|
@ -3,19 +3,22 @@ require 'logger'
|
|||||||
require './test/replica_sets/rs_test_helper'
|
require './test/replica_sets/rs_test_helper'
|
||||||
|
|
||||||
class ComplexConnectTest < Test::Unit::TestCase
|
class ComplexConnectTest < Test::Unit::TestCase
|
||||||
include ReplicaSetTest
|
|
||||||
|
def setup
|
||||||
|
ensure_rs
|
||||||
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
self.rs.restart_killed_nodes
|
@rs.restart_killed_nodes
|
||||||
@conn.close if defined?(@conn) && @conn
|
@conn.close if defined?(@conn) && @conn
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_complex_connect
|
def test_complex_connect
|
||||||
logger = Logger.new(STDOUT)
|
logger = Logger.new(STDOUT)
|
||||||
primary = Connection.new(self.rs.host, self.rs.ports[0])
|
primary = Connection.new(@rs.host, @rs.ports[0])
|
||||||
|
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[2]], [self.rs.host, self.rs.ports[1]],
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[2]], [@rs.host, @rs.ports[1]],
|
||||||
[self.rs.host, self.rs.ports[0]], :logger => logger)
|
[@rs.host, @rs.ports[0]], :logger => logger)
|
||||||
|
|
||||||
@conn['test']['foo'].insert({:a => 1})
|
@conn['test']['foo'].insert({:a => 1})
|
||||||
assert @conn['test']['foo'].find_one
|
assert @conn['test']['foo'].find_one
|
||||||
@ -23,13 +26,13 @@ class ComplexConnectTest < Test::Unit::TestCase
|
|||||||
config = primary['local']['system.replset'].find_one
|
config = primary['local']['system.replset'].find_one
|
||||||
config['version'] += 1
|
config['version'] += 1
|
||||||
config['members'].delete_if do |member|
|
config['members'].delete_if do |member|
|
||||||
member['host'].include?(self.rs.ports[2].to_s)
|
member['host'].include?(@rs.ports[2].to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_raise ConnectionFailure do
|
assert_raise ConnectionFailure do
|
||||||
primary['admin'].command({:replSetReconfig => config})
|
primary['admin'].command({:replSetReconfig => config})
|
||||||
end
|
end
|
||||||
self.rs.ensure_up
|
@rs.ensure_up
|
||||||
assert_raise ConnectionFailure do
|
assert_raise ConnectionFailure do
|
||||||
primary['admin'].command({:replSetStepDown => 1})
|
primary['admin'].command({:replSetStepDown => 1})
|
||||||
end
|
end
|
||||||
|
@ -2,68 +2,70 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|||||||
require './test/replica_sets/rs_test_helper'
|
require './test/replica_sets/rs_test_helper'
|
||||||
|
|
||||||
class ConnectTest < Test::Unit::TestCase
|
class ConnectTest < Test::Unit::TestCase
|
||||||
include ReplicaSetTest
|
def setup
|
||||||
|
ensure_rs
|
||||||
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
self.rs.restart_killed_nodes
|
@rs.restart_killed_nodes
|
||||||
@conn.close if defined?(@conn) && @conn
|
@conn.close if defined?(@conn) && @conn
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO: test connect timeout.
|
# TODO: test connect timeout.
|
||||||
|
|
||||||
def test_connect_with_deprecated_multi
|
def test_connect_with_deprecated_multi
|
||||||
@conn = Connection.multi([[self.rs.host, self.rs.ports[0]], [self.rs.host, self.rs.ports[1]]], :name => self.rs.name)
|
@conn = Connection.multi([[@rs.host, @rs.ports[0]], [@rs.host, @rs.ports[1]]], :name => @rs.name)
|
||||||
assert @conn.is_a?(ReplSetConnection)
|
assert @conn.is_a?(ReplSetConnection)
|
||||||
assert @conn.connected?
|
assert @conn.connected?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_connect_bad_name
|
def test_connect_bad_name
|
||||||
assert_raise_error(ReplicaSetConnectionError, "-wrong") do
|
assert_raise_error(ReplicaSetConnectionError, "-wrong") do
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]], [self.rs.host, self.rs.ports[1]],
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[0]], [@rs.host, @rs.ports[1]],
|
||||||
[self.rs.host, self.rs.ports[2]], :name => self.rs.name + "-wrong")
|
[@rs.host, @rs.ports[2]], :name => @rs.name + "-wrong")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_connect_with_primary_node_killed
|
def test_connect_with_primary_node_killed
|
||||||
node = self.rs.kill_primary
|
node = @rs.kill_primary
|
||||||
|
|
||||||
# Becuase we're killing the primary and trying to connect right away,
|
# Becuase we're killing the primary and trying to connect right away,
|
||||||
# this is going to fail right away.
|
# this is going to fail right away.
|
||||||
assert_raise_error(ConnectionFailure, "Failed to connect to primary node") do
|
assert_raise_error(ConnectionFailure, "Failed to connect to primary node") do
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]], [self.rs.host, self.rs.ports[1]],
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[0]], [@rs.host, @rs.ports[1]],
|
||||||
[self.rs.host, self.rs.ports[2]])
|
[@rs.host, @rs.ports[2]])
|
||||||
end
|
end
|
||||||
|
|
||||||
# This allows the secondary to come up as a primary
|
# This allows the secondary to come up as a primary
|
||||||
rescue_connection_failure do
|
rescue_connection_failure do
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]], [self.rs.host, self.rs.ports[1]],
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[0]], [@rs.host, @rs.ports[1]],
|
||||||
[self.rs.host, self.rs.ports[2]])
|
[@rs.host, @rs.ports[2]])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_connect_with_secondary_node_killed
|
def test_connect_with_secondary_node_killed
|
||||||
node = self.rs.kill_secondary
|
node = @rs.kill_secondary
|
||||||
|
|
||||||
rescue_connection_failure do
|
rescue_connection_failure do
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]], [self.rs.host, self.rs.ports[1]],
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[0]], [@rs.host, @rs.ports[1]],
|
||||||
[self.rs.host, self.rs.ports[2]])
|
[@rs.host, @rs.ports[2]])
|
||||||
end
|
end
|
||||||
assert @conn.connected?
|
assert @conn.connected?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_connect_with_third_node_killed
|
def test_connect_with_third_node_killed
|
||||||
self.rs.kill(self.rs.get_node_from_port(self.rs.ports[2]))
|
@rs.kill(@rs.get_node_from_port(@rs.ports[2]))
|
||||||
|
|
||||||
rescue_connection_failure do
|
rescue_connection_failure do
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]], [self.rs.host, self.rs.ports[1]],
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[0]], [@rs.host, @rs.ports[1]],
|
||||||
[self.rs.host, self.rs.ports[2]])
|
[@rs.host, @rs.ports[2]])
|
||||||
end
|
end
|
||||||
assert @conn.connected?
|
assert @conn.connected?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_connect_with_primary_stepped_down
|
def test_connect_with_primary_stepped_down
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]], [self.rs.host, self.rs.ports[1]],
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[0]], [@rs.host, @rs.ports[1]],
|
||||||
[self.rs.host, self.rs.ports[2]])
|
[@rs.host, @rs.ports[2]])
|
||||||
@conn[MONGO_TEST_DB]['bar'].save({:a => 1}, {:safe => {:w => 3}})
|
@conn[MONGO_TEST_DB]['bar'].save({:a => 1}, {:safe => {:w => 3}})
|
||||||
assert @conn[MONGO_TEST_DB]['bar'].find_one
|
assert @conn[MONGO_TEST_DB]['bar'].find_one
|
||||||
|
|
||||||
@ -83,8 +85,8 @@ class ConnectTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_save_with_primary_stepped_down
|
def test_save_with_primary_stepped_down
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]], [self.rs.host, self.rs.ports[1]],
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[0]], [@rs.host, @rs.ports[1]],
|
||||||
[self.rs.host, self.rs.ports[2]])
|
[@rs.host, @rs.ports[2]])
|
||||||
|
|
||||||
primary = Mongo::Connection.new(@conn.primary_pool.host, @conn.primary_pool.port)
|
primary = Mongo::Connection.new(@conn.primary_pool.host, @conn.primary_pool.port)
|
||||||
|
|
||||||
@ -102,13 +104,13 @@ class ConnectTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_connect_with_connection_string
|
def test_connect_with_connection_string
|
||||||
@conn = Connection.from_uri("mongodb://#{self.rs.host}:#{self.rs.ports[0]},#{self.rs.host}:#{self.rs.ports[1]}?replicaset=#{self.rs.name}")
|
@conn = Connection.from_uri("mongodb://#{@rs.host}:#{@rs.ports[0]},#{@rs.host}:#{@rs.ports[1]}?replicaset=#{@rs.name}")
|
||||||
assert @conn.is_a?(ReplSetConnection)
|
assert @conn.is_a?(ReplSetConnection)
|
||||||
assert @conn.connected?
|
assert @conn.connected?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_connect_with_full_connection_string
|
def test_connect_with_full_connection_string
|
||||||
@conn = Connection.from_uri("mongodb://#{self.rs.host}:#{self.rs.ports[0]},#{self.rs.host}:#{self.rs.ports[1]}?replicaset=#{self.rs.name};safe=true;w=2;fsync=true;slaveok=true")
|
@conn = Connection.from_uri("mongodb://#{@rs.host}:#{@rs.ports[0]},#{@rs.host}:#{@rs.ports[1]}?replicaset=#{@rs.name};safe=true;w=2;fsync=true;slaveok=true")
|
||||||
assert @conn.is_a?(ReplSetConnection)
|
assert @conn.is_a?(ReplSetConnection)
|
||||||
assert @conn.connected?
|
assert @conn.connected?
|
||||||
assert_equal 2, @conn.safe[:w]
|
assert_equal 2, @conn.safe[:w]
|
||||||
|
@ -2,11 +2,11 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|||||||
require './test/replica_sets/rs_test_helper'
|
require './test/replica_sets/rs_test_helper'
|
||||||
|
|
||||||
class ReplicaSetCountTest < Test::Unit::TestCase
|
class ReplicaSetCountTest < Test::Unit::TestCase
|
||||||
include ReplicaSetTest
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]],
|
ensure_rs
|
||||||
[self.rs.host, self.rs.ports[1]], [self.rs.host, self.rs.ports[2]],
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[0]],
|
||||||
|
[@rs.host, @rs.ports[1]], [@rs.host, @rs.ports[2]],
|
||||||
:read => :secondary)
|
:read => :secondary)
|
||||||
assert @conn.primary_pool
|
assert @conn.primary_pool
|
||||||
@primary = Connection.new(@conn.primary_pool.host, @conn.primary_pool.port)
|
@primary = Connection.new(@conn.primary_pool.host, @conn.primary_pool.port)
|
||||||
@ -16,7 +16,7 @@ class ReplicaSetCountTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
self.rs.restart_killed_nodes
|
@rs.restart_killed_nodes
|
||||||
@conn.close if @conn
|
@conn.close if @conn
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ class ReplicaSetCountTest < Test::Unit::TestCase
|
|||||||
assert_equal 1, @coll.count
|
assert_equal 1, @coll.count
|
||||||
|
|
||||||
# Kill the current master node
|
# Kill the current master node
|
||||||
@node = self.rs.kill_primary
|
@node = @rs.kill_primary
|
||||||
|
|
||||||
rescue_connection_failure do
|
rescue_connection_failure do
|
||||||
@coll.insert({:a => 30}, :safe => true)
|
@coll.insert({:a => 30}, :safe => true)
|
||||||
|
@ -2,25 +2,25 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|||||||
require './test/replica_sets/rs_test_helper'
|
require './test/replica_sets/rs_test_helper'
|
||||||
|
|
||||||
class ReplicaSetInsertTest < Test::Unit::TestCase
|
class ReplicaSetInsertTest < Test::Unit::TestCase
|
||||||
include ReplicaSetTest
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@conn = ReplSetConnection.new([TEST_HOST, self.rs.ports[0]],
|
ensure_rs
|
||||||
[TEST_HOST, self.rs.ports[1]], [TEST_HOST, self.rs.ports[2]])
|
@conn = ReplSetConnection.new([TEST_HOST, @rs.ports[0]],
|
||||||
|
[TEST_HOST, @rs.ports[1]], [TEST_HOST, @rs.ports[2]])
|
||||||
@db = @conn.db(MONGO_TEST_DB)
|
@db = @conn.db(MONGO_TEST_DB)
|
||||||
@db.drop_collection("test-sets")
|
@db.drop_collection("test-sets")
|
||||||
@coll = @db.collection("test-sets")
|
@coll = @db.collection("test-sets")
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
self.rs.restart_killed_nodes
|
@rs.restart_killed_nodes
|
||||||
@conn.close if @conn
|
@conn.close if @conn
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_insert
|
def test_insert
|
||||||
@coll.save({:a => 20}, :safe => true)
|
@coll.save({:a => 20}, :safe => true)
|
||||||
|
|
||||||
self.rs.kill_primary
|
@rs.kill_primary
|
||||||
|
|
||||||
rescue_connection_failure do
|
rescue_connection_failure do
|
||||||
@coll.save({:a => 30}, :safe => true)
|
@coll.save({:a => 30}, :safe => true)
|
||||||
@ -32,7 +32,7 @@ class ReplicaSetInsertTest < Test::Unit::TestCase
|
|||||||
@coll.save({:a => 70}, :safe => true)
|
@coll.save({:a => 70}, :safe => true)
|
||||||
|
|
||||||
# Restart the old master and wait for sync
|
# Restart the old master and wait for sync
|
||||||
self.rs.restart_killed_nodes
|
@rs.restart_killed_nodes
|
||||||
sleep(1)
|
sleep(1)
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
|
@ -4,18 +4,18 @@ require './test/replica_sets/rs_test_helper'
|
|||||||
# NOTE: This test expects a replica set of three nodes to be running
|
# NOTE: This test expects a replica set of three nodes to be running
|
||||||
# on the local host.
|
# on the local host.
|
||||||
class ReplicaSetPooledInsertTest < Test::Unit::TestCase
|
class ReplicaSetPooledInsertTest < Test::Unit::TestCase
|
||||||
include ReplicaSetTest
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]], [self.rs.host, self.rs.ports[1]],
|
ensure_rs
|
||||||
[self.rs.host, self.rs.ports[2]], :pool_size => 5, :timeout => 5, :refresh_mode => false)
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[0]], [@rs.host, @rs.ports[1]],
|
||||||
|
[@rs.host, @rs.ports[2]], :pool_size => 5, :timeout => 5, :refresh_mode => false)
|
||||||
@db = @conn.db(MONGO_TEST_DB)
|
@db = @conn.db(MONGO_TEST_DB)
|
||||||
@db.drop_collection("test-sets")
|
@db.drop_collection("test-sets")
|
||||||
@coll = @db.collection("test-sets")
|
@coll = @db.collection("test-sets")
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
self.rs.restart_killed_nodes
|
@rs.restart_killed_nodes
|
||||||
@conn.close if @conn
|
@conn.close if @conn
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ class ReplicaSetPooledInsertTest < Test::Unit::TestCase
|
|||||||
expected_results = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
expected_results = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||||
@coll.save({:a => -1}, :safe => true)
|
@coll.save({:a => -1}, :safe => true)
|
||||||
|
|
||||||
self.rs.kill_primary
|
@rs.kill_primary
|
||||||
|
|
||||||
threads = []
|
threads = []
|
||||||
10.times do |i|
|
10.times do |i|
|
||||||
@ -37,7 +37,7 @@ class ReplicaSetPooledInsertTest < Test::Unit::TestCase
|
|||||||
threads.each {|t| t.join}
|
threads.each {|t| t.join}
|
||||||
|
|
||||||
# Restart the old master and wait for sync
|
# Restart the old master and wait for sync
|
||||||
self.rs.restart_killed_nodes
|
@rs.restart_killed_nodes
|
||||||
sleep(1)
|
sleep(1)
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
|
@ -2,17 +2,17 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|||||||
require './test/replica_sets/rs_test_helper'
|
require './test/replica_sets/rs_test_helper'
|
||||||
|
|
||||||
class ReplicaSetQueryTest < Test::Unit::TestCase
|
class ReplicaSetQueryTest < Test::Unit::TestCase
|
||||||
include ReplicaSetTest
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]])
|
ensure_rs
|
||||||
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[0]])
|
||||||
@db = @conn.db(MONGO_TEST_DB)
|
@db = @conn.db(MONGO_TEST_DB)
|
||||||
@db.drop_collection("test-sets")
|
@db.drop_collection("test-sets")
|
||||||
@coll = @db.collection("test-sets")
|
@coll = @db.collection("test-sets")
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
self.rs.restart_killed_nodes
|
@rs.restart_killed_nodes
|
||||||
@conn.close if @conn
|
@conn.close if @conn
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ class ReplicaSetQueryTest < Test::Unit::TestCase
|
|||||||
|
|
||||||
puts "Benchmark before failover: #{benchmark_queries}"
|
puts "Benchmark before failover: #{benchmark_queries}"
|
||||||
|
|
||||||
self.rs.kill_primary
|
@rs.kill_primary
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
rescue_connection_failure do
|
rescue_connection_failure do
|
||||||
|
@ -3,12 +3,12 @@ require './test/replica_sets/rs_test_helper'
|
|||||||
require 'logger'
|
require 'logger'
|
||||||
|
|
||||||
class ReadPreferenceTest < Test::Unit::TestCase
|
class ReadPreferenceTest < Test::Unit::TestCase
|
||||||
include ReplicaSetTest
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
|
ensure_rs
|
||||||
log = Logger.new("test.log")
|
log = Logger.new("test.log")
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]],
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[0]],
|
||||||
[self.rs.host, self.rs.ports[1]],
|
[@rs.host, @rs.ports[1]],
|
||||||
:read => :secondary, :pool_size => 50,
|
:read => :secondary, :pool_size => 50,
|
||||||
:refresh_mode => false, :refresh_interval => 5, :logger => log)
|
:refresh_mode => false, :refresh_interval => 5, :logger => log)
|
||||||
@db = @conn.db(MONGO_TEST_DB)
|
@db = @conn.db(MONGO_TEST_DB)
|
||||||
@ -17,7 +17,7 @@ class ReadPreferenceTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
self.rs.restart_killed_nodes
|
@rs.restart_killed_nodes
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_read_primary
|
def test_read_primary
|
||||||
@ -35,7 +35,7 @@ class ReadPreferenceTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_query_secondaries
|
def test_query_secondaries
|
||||||
@secondary = Connection.new(self.rs.host, @conn.read_pool.port, :slave_ok => true)
|
@secondary = Connection.new(@rs.host, @conn.read_pool.port, :slave_ok => true)
|
||||||
@coll = @db.collection("test-sets", :safe => {:w => 3, :wtimeout => 20000})
|
@coll = @db.collection("test-sets", :safe => {:w => 3, :wtimeout => 20000})
|
||||||
@coll.save({:a => 20})
|
@coll.save({:a => 20})
|
||||||
@coll.save({:a => 30})
|
@coll.save({:a => 30})
|
||||||
@ -49,7 +49,7 @@ class ReadPreferenceTest < Test::Unit::TestCase
|
|||||||
assert results.include?(30)
|
assert results.include?(30)
|
||||||
assert results.include?(40)
|
assert results.include?(40)
|
||||||
|
|
||||||
self.rs.kill_primary
|
@rs.kill_primary
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
rescue_connection_failure do
|
rescue_connection_failure do
|
||||||
@ -68,13 +68,13 @@ class ReadPreferenceTest < Test::Unit::TestCase
|
|||||||
assert_equal 2, @coll.find.to_a.length
|
assert_equal 2, @coll.find.to_a.length
|
||||||
|
|
||||||
# Should still be able to read immediately after killing master node
|
# Should still be able to read immediately after killing master node
|
||||||
self.rs.kill_primary
|
@rs.kill_primary
|
||||||
assert_equal 2, @coll.find.to_a.length
|
assert_equal 2, @coll.find.to_a.length
|
||||||
rescue_connection_failure do
|
rescue_connection_failure do
|
||||||
puts "@coll.save()"
|
puts "@coll.save()"
|
||||||
@coll.save({:a => 50}, :safe => {:w => 2, :wtimeout => 10000})
|
@coll.save({:a => 50}, :safe => {:w => 2, :wtimeout => 10000})
|
||||||
end
|
end
|
||||||
self.rs.restart_killed_nodes
|
@rs.restart_killed_nodes
|
||||||
@coll.save({:a => 50}, :safe => {:w => 2, :wtimeout => 10000})
|
@coll.save({:a => 50}, :safe => {:w => 2, :wtimeout => 10000})
|
||||||
assert_equal 4, @coll.find.to_a.length
|
assert_equal 4, @coll.find.to_a.length
|
||||||
end
|
end
|
||||||
@ -85,8 +85,8 @@ class ReadPreferenceTest < Test::Unit::TestCase
|
|||||||
@coll.save({:a => 30})
|
@coll.save({:a => 30})
|
||||||
assert_equal 2, @coll.find.to_a.length
|
assert_equal 2, @coll.find.to_a.length
|
||||||
|
|
||||||
read_node = self.rs.get_node_from_port(@conn.read_pool.port)
|
read_node = @rs.get_node_from_port(@conn.read_pool.port)
|
||||||
self.rs.kill(read_node)
|
@rs.kill(read_node)
|
||||||
|
|
||||||
# Should fail immediately on next read
|
# Should fail immediately on next read
|
||||||
old_read_pool_port = @conn.read_pool.port
|
old_read_pool_port = @conn.read_pool.port
|
||||||
@ -141,7 +141,7 @@ class ReadPreferenceTest < Test::Unit::TestCase
|
|||||||
# end
|
# end
|
||||||
|
|
||||||
#def teardown
|
#def teardown
|
||||||
# self.rs.restart_killed_nodes
|
# @rs.restart_killed_nodes
|
||||||
#end
|
#end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -3,14 +3,14 @@ require './test/replica_sets/rs_test_helper'
|
|||||||
require 'benchmark'
|
require 'benchmark'
|
||||||
|
|
||||||
class ReplicaSetRefreshTest < Test::Unit::TestCase
|
class ReplicaSetRefreshTest < Test::Unit::TestCase
|
||||||
include ReplicaSetTest
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
|
ensure_rs
|
||||||
@conn = nil
|
@conn = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
self.rs.restart_killed_nodes
|
@rs.restart_killed_nodes
|
||||||
@conn.close if @conn
|
@conn.close if @conn
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -18,16 +18,16 @@ class ReplicaSetRefreshTest < Test::Unit::TestCase
|
|||||||
Benchmark.bm do |x|
|
Benchmark.bm do |x|
|
||||||
x.report("Connect") do
|
x.report("Connect") do
|
||||||
10.times do
|
10.times do
|
||||||
ReplSetConnection.new([self.rs.host, self.rs.ports[0]],
|
ReplSetConnection.new([@rs.host, @rs.ports[0]],
|
||||||
[self.rs.host, self.rs.ports[1]],
|
[@rs.host, @rs.ports[1]],
|
||||||
[self.rs.host, self.rs.ports[2]],
|
[@rs.host, @rs.ports[2]],
|
||||||
:refresh_mode => false)
|
:refresh_mode => false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@con = ReplSetConnection.new([self.rs.host, self.rs.ports[0]],
|
@con = ReplSetConnection.new([@rs.host, @rs.ports[0]],
|
||||||
[self.rs.host, self.rs.ports[1]],
|
[@rs.host, @rs.ports[1]],
|
||||||
[self.rs.host, self.rs.ports[2]],
|
[@rs.host, @rs.ports[2]],
|
||||||
:refresh_mode => false)
|
:refresh_mode => false)
|
||||||
|
|
||||||
x.report("manager") do
|
x.report("manager") do
|
||||||
@ -40,12 +40,12 @@ class ReplicaSetRefreshTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_connect_and_manual_refresh_with_secondaries_down
|
def test_connect_and_manual_refresh_with_secondaries_down
|
||||||
self.rs.kill_all_secondaries
|
@rs.kill_all_secondaries
|
||||||
|
|
||||||
rescue_connection_failure do
|
rescue_connection_failure do
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]],
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[0]],
|
||||||
[self.rs.host, self.rs.ports[1]],
|
[@rs.host, @rs.ports[1]],
|
||||||
[self.rs.host, self.rs.ports[2]],
|
[@rs.host, @rs.ports[2]],
|
||||||
:refresh_mode => false)
|
:refresh_mode => false)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ class ReplicaSetRefreshTest < Test::Unit::TestCase
|
|||||||
assert @conn.connected?
|
assert @conn.connected?
|
||||||
assert_equal @conn.read_pool, @conn.primary_pool
|
assert_equal @conn.read_pool, @conn.primary_pool
|
||||||
|
|
||||||
self.rs.restart_killed_nodes
|
@rs.restart_killed_nodes
|
||||||
assert_equal [], @conn.secondaries
|
assert_equal [], @conn.secondaries
|
||||||
assert @conn.connected?
|
assert @conn.connected?
|
||||||
assert_equal @conn.read_pool, @conn.primary_pool
|
assert_equal @conn.read_pool, @conn.primary_pool
|
||||||
@ -71,12 +71,12 @@ class ReplicaSetRefreshTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_automated_refresh_with_secondaries_down
|
def test_automated_refresh_with_secondaries_down
|
||||||
self.rs.kill_all_secondaries
|
@rs.kill_all_secondaries
|
||||||
|
|
||||||
rescue_connection_failure do
|
rescue_connection_failure do
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]],
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[0]],
|
||||||
[self.rs.host, self.rs.ports[1]],
|
[@rs.host, @rs.ports[1]],
|
||||||
[self.rs.host, self.rs.ports[2]],
|
[@rs.host, @rs.ports[2]],
|
||||||
:refresh_interval => 2,
|
:refresh_interval => 2,
|
||||||
:refresh_mode => :sync)
|
:refresh_mode => :sync)
|
||||||
end
|
end
|
||||||
@ -86,7 +86,7 @@ class ReplicaSetRefreshTest < Test::Unit::TestCase
|
|||||||
assert_equal @conn.read_pool, @conn.primary_pool
|
assert_equal @conn.read_pool, @conn.primary_pool
|
||||||
old_refresh_version = @conn.refresh_version
|
old_refresh_version = @conn.refresh_version
|
||||||
|
|
||||||
self.rs.restart_killed_nodes
|
@rs.restart_killed_nodes
|
||||||
sleep(4)
|
sleep(4)
|
||||||
@conn['foo']['bar'].find_one
|
@conn['foo']['bar'].find_one
|
||||||
@conn['foo']['bar'].insert({:a => 1})
|
@conn['foo']['bar'].insert({:a => 1})
|
||||||
@ -100,16 +100,16 @@ class ReplicaSetRefreshTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_automated_refresh_when_secondary_goes_down
|
def test_automated_refresh_when_secondary_goes_down
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]],
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[0]],
|
||||||
[self.rs.host, self.rs.ports[1]],
|
[@rs.host, @rs.ports[1]],
|
||||||
[self.rs.host, self.rs.ports[2]],
|
[@rs.host, @rs.ports[2]],
|
||||||
:refresh_interval => 2,
|
:refresh_interval => 2,
|
||||||
:refresh_mode => :sync)
|
:refresh_mode => :sync)
|
||||||
|
|
||||||
num_secondaries = @conn.secondary_pools.length
|
num_secondaries = @conn.secondary_pools.length
|
||||||
old_refresh_version = @conn.refresh_version
|
old_refresh_version = @conn.refresh_version
|
||||||
|
|
||||||
n = self.rs.kill_secondary
|
n = @rs.kill_secondary
|
||||||
sleep(4)
|
sleep(4)
|
||||||
@conn['foo']['bar'].find_one
|
@conn['foo']['bar'].find_one
|
||||||
|
|
||||||
@ -118,20 +118,20 @@ class ReplicaSetRefreshTest < Test::Unit::TestCase
|
|||||||
assert_equal num_secondaries - 1, @conn.secondaries.length
|
assert_equal num_secondaries - 1, @conn.secondaries.length
|
||||||
assert_equal num_secondaries - 1, @conn.secondary_pools.length
|
assert_equal num_secondaries - 1, @conn.secondary_pools.length
|
||||||
|
|
||||||
self.rs.restart_killed_nodes
|
@rs.restart_killed_nodes
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_automated_refresh_with_removed_node
|
def test_automated_refresh_with_removed_node
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]],
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[0]],
|
||||||
[self.rs.host, self.rs.ports[1]],
|
[@rs.host, @rs.ports[1]],
|
||||||
[self.rs.host, self.rs.ports[2]],
|
[@rs.host, @rs.ports[2]],
|
||||||
:refresh_interval => 2,
|
:refresh_interval => 2,
|
||||||
:refresh_mode => :sync)
|
:refresh_mode => :sync)
|
||||||
|
|
||||||
num_secondaries = @conn.secondary_pools.length
|
num_secondaries = @conn.secondary_pools.length
|
||||||
old_refresh_version = @conn.refresh_version
|
old_refresh_version = @conn.refresh_version
|
||||||
|
|
||||||
n = self.rs.remove_secondary_node
|
n = @rs.remove_secondary_node
|
||||||
sleep(4)
|
sleep(4)
|
||||||
@conn['foo']['bar'].find_one
|
@conn['foo']['bar'].find_one
|
||||||
|
|
||||||
@ -140,22 +140,22 @@ class ReplicaSetRefreshTest < Test::Unit::TestCase
|
|||||||
assert_equal num_secondaries - 1, @conn.secondaries.length
|
assert_equal num_secondaries - 1, @conn.secondaries.length
|
||||||
assert_equal num_secondaries - 1, @conn.secondary_pools.length
|
assert_equal num_secondaries - 1, @conn.secondary_pools.length
|
||||||
|
|
||||||
self.rs.add_node(n)
|
@rs.add_node(n)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_adding_and_removing_nodes
|
def test_adding_and_removing_nodes
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]],
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[0]],
|
||||||
[self.rs.host, self.rs.ports[1]],
|
[@rs.host, @rs.ports[1]],
|
||||||
[self.rs.host, self.rs.ports[2]],
|
[@rs.host, @rs.ports[2]],
|
||||||
:refresh_interval => 2, :refresh_mode => :sync)
|
:refresh_interval => 2, :refresh_mode => :sync)
|
||||||
|
|
||||||
self.rs.add_node
|
@rs.add_node
|
||||||
sleep(4)
|
sleep(4)
|
||||||
@conn['foo']['bar'].find_one
|
@conn['foo']['bar'].find_one
|
||||||
|
|
||||||
@conn2 = ReplSetConnection.new([self.rs.host, self.rs.ports[0]],
|
@conn2 = ReplSetConnection.new([@rs.host, @rs.ports[0]],
|
||||||
[self.rs.host, self.rs.ports[1]],
|
[@rs.host, @rs.ports[1]],
|
||||||
[self.rs.host, self.rs.ports[2]],
|
[@rs.host, @rs.ports[2]],
|
||||||
:refresh_interval => 2, :refresh_mode => :sync)
|
:refresh_interval => 2, :refresh_mode => :sync)
|
||||||
|
|
||||||
assert @conn2.secondaries.sort == @conn.secondaries.sort,
|
assert @conn2.secondaries.sort == @conn.secondaries.sort,
|
||||||
@ -165,7 +165,7 @@ class ReplicaSetRefreshTest < Test::Unit::TestCase
|
|||||||
|
|
||||||
config = @conn['admin'].command({:ismaster => 1})
|
config = @conn['admin'].command({:ismaster => 1})
|
||||||
|
|
||||||
self.rs.remove_secondary_node
|
@rs.remove_secondary_node
|
||||||
sleep(4)
|
sleep(4)
|
||||||
config = @conn['admin'].command({:ismaster => 1})
|
config = @conn['admin'].command({:ismaster => 1})
|
||||||
|
|
||||||
|
@ -3,21 +3,21 @@ require './test/replica_sets/rs_test_helper'
|
|||||||
require 'benchmark'
|
require 'benchmark'
|
||||||
|
|
||||||
class ReplicaSetRefreshWithThreadsTest < Test::Unit::TestCase
|
class ReplicaSetRefreshWithThreadsTest < Test::Unit::TestCase
|
||||||
include ReplicaSetTest
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
|
ensure_rs
|
||||||
@conn = nil
|
@conn = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
self.rs.restart_killed_nodes
|
@rs.restart_killed_nodes
|
||||||
@conn.close if @conn
|
@conn.close if @conn
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_read_write_load_with_added_nodes
|
def test_read_write_load_with_added_nodes
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]],
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[0]],
|
||||||
[self.rs.host, self.rs.ports[1]],
|
[@rs.host, @rs.ports[1]],
|
||||||
[self.rs.host, self.rs.ports[2]],
|
[@rs.host, @rs.ports[2]],
|
||||||
:refresh_interval => 5,
|
:refresh_interval => 5,
|
||||||
:refresh_mode => :sync,
|
:refresh_mode => :sync,
|
||||||
:read => :secondary)
|
:read => :secondary)
|
||||||
@ -44,7 +44,7 @@ class ReplicaSetRefreshWithThreadsTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self.rs.add_node
|
@rs.add_node
|
||||||
threads.each {|t| t.join }
|
threads.each {|t| t.join }
|
||||||
|
|
||||||
config = @conn['admin'].command({:ismaster => 1})
|
config = @conn['admin'].command({:ismaster => 1})
|
||||||
|
@ -2,10 +2,10 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|||||||
require './test/replica_sets/rs_test_helper'
|
require './test/replica_sets/rs_test_helper'
|
||||||
|
|
||||||
class ReplicaSetAckTest < Test::Unit::TestCase
|
class ReplicaSetAckTest < Test::Unit::TestCase
|
||||||
include ReplicaSetTest
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]])
|
ensure_rs
|
||||||
|
@conn = ReplSetConnection.new([@rs.host, @rs.ports[0]])
|
||||||
|
|
||||||
@slave1 = Connection.new(@conn.secondary_pools[0].host,
|
@slave1 = Connection.new(@conn.secondary_pools[0].host,
|
||||||
@conn.secondary_pools[0].port, :slave_ok => true)
|
@conn.secondary_pools[0].port, :slave_ok => true)
|
||||||
@ -18,7 +18,7 @@ class ReplicaSetAckTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
self.rs.restart_killed_nodes
|
@rs.restart_killed_nodes
|
||||||
@conn.close if @conn
|
@conn.close if @conn
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2,18 +2,16 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|||||||
require './test/test_helper'
|
require './test/test_helper'
|
||||||
require './test/tools/repl_set_manager'
|
require './test/tools/repl_set_manager'
|
||||||
|
|
||||||
module ReplicaSetTest
|
class Test::Unit::TestCase
|
||||||
|
# Ensure replica set is available as an instance variable and that
|
||||||
def self.rs
|
# a new set is spun up for each TestCase class
|
||||||
unless defined?(@rs)
|
def ensure_rs
|
||||||
@rs = ReplSetManager.new
|
unless defined?(@@current_class) and @@current_class == self.class
|
||||||
@rs.start_set
|
@@current_class = self.class
|
||||||
|
@@rs = ReplSetManager.new
|
||||||
|
@@rs.start_set
|
||||||
end
|
end
|
||||||
@rs
|
@rs = @@rs
|
||||||
end
|
|
||||||
|
|
||||||
def rs
|
|
||||||
ReplicaSetTest.rs
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Generic code for rescuing connection failures and retrying operations.
|
# Generic code for rescuing connection failures and retrying operations.
|
||||||
|
Loading…
Reference in New Issue
Block a user