RUBY-376 always cache original seed nodes

This commit is contained in:
Kyle Banker 2011-12-02 17:20:04 -05:00
parent 03303b8409
commit b579a6347f
2 changed files with 9 additions and 1 deletions

View File

@ -271,7 +271,8 @@ module Mongo
end
def update_seed_list(members)
@seeds = members.map { |n| n.host_port }
current_members = members.map { |n| n.host_port }
@seeds = (@seeds + current_members).uniq
end
end

View File

@ -23,6 +23,13 @@ class BasicTest < Test::Unit::TestCase
assert @conn.connected?
end
def test_cache_original_seed_nodes
@conn = ReplSetConnection.new([self.rs.host, self.rs.ports[1]], [self.rs.host, self.rs.ports[0]],
[self.rs.host, self.rs.ports[2]], [self.rs.host, 19356], :name => self.rs.name)
assert @conn.connected?
assert @conn.seeds.include?([self.rs.host, 19356]), "Original seed nodes not cached!"
end
def test_accessors
seeds = [[self.rs.host, self.rs.ports[0]], [self.rs.host, self.rs.ports[1]],
[self.rs.host, self.rs.ports[2]]]