From 02d7a3c5ddffa086e2bf8b81964bbdfc2f165a78 Mon Sep 17 00:00:00 2001 From: Kyle Banker Date: Mon, 5 Dec 2011 18:31:29 -0500 Subject: [PATCH] minor: test --- test/replica_sets/refresh_test.rb | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/test/replica_sets/refresh_test.rb b/test/replica_sets/refresh_test.rb index 78eb8c5..3d13a5f 100644 --- a/test/replica_sets/refresh_test.rb +++ b/test/replica_sets/refresh_test.rb @@ -39,7 +39,26 @@ class ReplicaSetRefreshTest < Test::Unit::TestCase end end - def test_connect_and_manual_refresh_with_secondaries_down + def test_refresh_with_small_refresh_interval_zero + @conn = ReplSetConnection.new([self.rs.host, self.rs.ports[0]], + [self.rs.host, self.rs.ports[1]], + [self.rs.host, self.rs.ports[2]], + :refresh_mode => :sync, :refresh_interval => 1) + + @conn[MONGO_TEST_DB]['foo'].insert({:a => 1}, {:safe => {:w => 3}}) + primary = Mongo::Connection.new(@conn.primary_pool.host, @conn.primary_pool.port) + primary['admin'].command({:replSetStepDown => 60}) + + assert_raise_error Mongo::OperationFailure, "not master" do + @conn[MONGO_TEST_DB]['foo'].insert({:a => 1}, {:safe => true}) + end + + rescue_connection_failure do + assert @conn[MONGO_TEST_DB]['foo'].insert({:a => 1}, {:safe => true}) + end + end + + def test_connect_and_manual_refresh_with_secondaries_down self.rs.kill_all_secondaries rescue_connection_failure do