From b9371206dcfd841712b1e3611799fb5864f5a620 Mon Sep 17 00:00:00 2001 From: Tyler Brock Date: Sat, 18 Feb 2012 15:00:25 -0500 Subject: [PATCH] minor: improvements to ReplSetManager add_node can now take blocks new add_arbiter method --- test/tools/repl_set_manager.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/tools/repl_set_manager.rb b/test/tools/repl_set_manager.rb index 4bc5b37..f145de9 100644 --- a/test/tools/repl_set_manager.rb +++ b/test/tools/repl_set_manager.rb @@ -155,11 +155,11 @@ class ReplSetManager return secondary end - def add_node(n=nil) + def add_node(n=nil, &block) primary = get_node_with_state(1) con = get_connection(primary) - init_node(n || @mongods.length) + init_node(n || @mongods.length, &block) config = con['local']['system.replset'].find_one @config['version'] = config['version'] + 1 @@ -173,6 +173,12 @@ class ReplSetManager ensure_up end + def add_arbiter + add_node do |attrs| + attrs['arbiterOnly'] = true + end + end + def wait_for_death(pid) @retries.times do if `ps a | grep mongod`.include?("#{pid}")