File tree Expand file tree Collapse file tree 2 files changed +13
-10
lines changed
elasticsearch-transport/spec/elasticsearch/connections Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change 238238 end
239239
240240 it 'allows threads to select connections in parallel' do
241- expect ( 10 . times . collect do
241+ expect ( 10 . times . collect do
242242 threads = [ ]
243243 20 . times do
244244 threads << Thread . new do
245245 collection . get_connection
246246 end
247247 end
248- threads . collect { |t | t . join }
248+ threads . map { |t | t . join }
249249 collection . get_connection . host [ :host ]
250- end ) . to all ( eq ( 0 ) )
250+ end ) . to eq ( ( 0 .. 9 ) . to_a )
251251 end
252252 end
253253 end
Original file line number Diff line number Diff line change @@ -96,17 +96,20 @@ def select(options={})
9696 context 'when multiple threads are used' do
9797
9898 let ( :connections ) do
99- ( 1 .. 100 ) . to_a
99+ ( 0 .. 19 ) . to_a
100100 end
101101
102102 it 'allows threads to select connections in parallel' do
103- threads = [ ]
104- threads << Thread . new do
105- 2000 . times do |i |
106- selector . select
103+ expect ( 10 . times . collect do
104+ threads = [ ]
105+ 20 . times do
106+ threads << Thread . new do
107+ selector . select
108+ end
107109 end
108- end
109- threads . collect { |t | t . join }
110+ threads . map { |t | t . join }
111+ selector . select
112+ end ) . to eq ( ( 0 ..9 ) . to_a )
110113 end
111114 end
112115 end
You can’t perform that action at this time.
0 commit comments