File tree Expand file tree Collapse file tree 3 files changed +5
-3
lines changed
spec/mongo/cluster/topology Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,8 @@ def servers(servers)
144144 #
145145 # @since 2.0.6
146146 def add_hosts? ( description , servers )
147- !!( member_of_this_set? ( description ) && !has_primary? ( servers ) )
147+ !!( member_of_this_set? ( description ) &&
148+ ( !has_primary? ( servers ) || description . primary? ) )
148149 end
149150
150151 # Whether a description can be used to remove hosts from the cluster.
Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ class Description
147147 # Fields to exclude when comparing two descriptions.
148148 #
149149 # @since 2.0.6
150- EXCLUDE_FOR_COMPARISON = [ LOCAL_TIME , ELECTION_ID , SET_VERSION ] . freeze
150+ EXCLUDE_FOR_COMPARISON = [ LOCAL_TIME ] . freeze
151151
152152 # @return [ Address ] address The server's address.
153153 attr_reader :address
@@ -570,7 +570,6 @@ def me_mismatch?
570570 # @since 2.0.6
571571 def ==( other )
572572 return false if self . class != other . class
573- return true if config == other . config
574573 compare_config ( other )
575574 end
576575 alias_method :eql? , :==
Original file line number Diff line number Diff line change 160160 let ( :description ) do
161161 double ( 'description' ) . tap do |d |
162162 allow ( d ) . to receive ( :replica_set_member? ) . and_return ( false )
163+ allow ( d ) . to receive ( :primary? ) . and_return ( false )
163164 end
164165 end
165166
179180 double ( 'description' ) . tap do |d |
180181 allow ( d ) . to receive ( :replica_set_member? ) . and_return ( true )
181182 allow ( d ) . to receive ( :replica_set_name ) . and_return ( 'testing' )
183+ allow ( d ) . to receive ( :primary? ) . and_return ( false )
182184 end
183185 end
184186
You can’t perform that action at this time.
0 commit comments