Skip to content

Commit

Permalink
RUBY-379 RUBY-381 test
Browse files Browse the repository at this point in the history
  • Loading branch information
banker committed Dec 5, 2011
1 parent b6ff77f commit e0f44ca
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions test/replica_sets/connect_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,22 @@ def test_connect_with_third_node_killed
end

def test_connect_with_primary_stepped_down
self.rs.step_down_primary
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]], [self.rs.host, self.rs.ports[1]],
[self.rs.host, self.rs.ports[2]])
@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 = ReplSetConnection.new([self.rs.host, self.rs.ports[0]], [self.rs.host, self.rs.ports[1]],
[self.rs.host, self.rs.ports[2]])
@conn[MONGO_TEST_DB]['bar'].find_one
end
assert @conn.connected?
end

def test_connect_with_connection_string
Expand Down

0 comments on commit e0f44ca

Please sign in to comment.