spec/support/cmap.rb in mongo-2.10.5 vs spec/support/cmap.rb in mongo-2.11.0.rc0
- old
+ new
@@ -51,25 +51,21 @@
@ignore_events = @test['ignore'] || []
preprocess
end
- def setup(cluster)
- @subscriber = EventSubscriber.new
-
- monitoring = Mongo::Monitoring.new(monitoring: false)
- monitoring.subscribe(Mongo::Monitoring::CONNECTION_POOL, subscriber)
-
- server = Mongo::Server.new(
- Address.new(SpecConfig.instance.addresses.first),
- cluster,
- monitoring,
- Mongo::Event::Listeners.new,
- pool_options.merge(monitoring_io: false))
-
+ def setup(server, subscriber)
+ @subscriber = subscriber
@pool = server.pool
- @pool.populate
+
+ # let pool populate
+ ([0.1, 0.15, 0.15] + [0.2] * 20).each do |t|
+ if @pool.size >= @pool.min_size
+ break
+ end
+ sleep t
+ end
end
def run
state = {}
@@ -168,9 +164,12 @@
opts
end
end
# Converts the options given by the spec to the Ruby driver format.
+ #
+ # This method only handles options used by spec tests at the time when
+ # this method was written. Other options are silently dropped.
def process_options(options)
(options || {}).reduce({}) do |opts, kv|
case kv.first
when 'maxIdleTimeMS'
opts[:max_idle_time] = kv.last / 1000.0