Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

RUBY-379 RUBY-381 test

  • Loading branch information...
commit e0f44ca41d29ac34349e1ecaa501efdbc0eee29d 1 parent b6ff77f
@banker banker authored
Showing with 13 additions and 4 deletions.
  1. +13 −4 test/replica_sets/connect_test.rb
View
17 test/replica_sets/connect_test.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.