RUBY-379 RUBY-381 test
This commit is contained in:
parent
b6ff77fcbc
commit
e0f44ca41d
|
@ -62,13 +62,22 @@ class ConnectTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_connect_with_primary_stepped_down
|
||||
self.rs.step_down_primary
|
||||
|
||||
rescue_connection_failure do
|
||||
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]], [self.rs.host, self.rs.ports[1]],
|
||||
[self.rs.host, self.rs.ports[2]])
|
||||
end
|
||||
@conn[MONGO_TEST_DB]['bar'].save({:a => 1}, {:safe => {:w => 3}})
|
||||
assert @conn[MONGO_TEST_DB]['bar'].find_one
|
||||
|
||||
primary = Mongo::Connection.new(@conn.primary_pool.host, @conn.primary_pool.port)
|
||||
primary['admin'].command({:replSetStepDown => 60})
|
||||
assert @conn.connected?
|
||||
assert_raise_error Mongo::ConnectionFailure, "not master" do
|
||||
@conn[MONGO_TEST_DB]['bar'].find_one
|
||||
end
|
||||
assert !@conn.connected?
|
||||
|
||||
rescue_connection_failure do
|
||||
@conn[MONGO_TEST_DB]['bar'].find_one
|
||||
end
|
||||
end
|
||||
|
||||
def test_connect_with_connection_string
|
||||
|
|
Loading…
Reference in New Issue