From 2fab3907c0893106693d46353debb09dd6908105 Mon Sep 17 00:00:00 2001 From: Hauke Klement Date: Sun, 15 Feb 2015 11:10:18 +0100 Subject: [PATCH] fixed Docker configuration --- config/docker.yml.erb | 4 ++-- spec/lib/docker_container_pool_spec.rb | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/config/docker.yml.erb b/config/docker.yml.erb index cefb8ba7..79b8da17 100644 --- a/config/docker.yml.erb +++ b/config/docker.yml.erb @@ -2,8 +2,6 @@ default: &default connection_timeout: 3 pool: active: false - interval: 15 - maximum_refill_count: 32 ports: !ruby/range 4500..4600 development: @@ -15,6 +13,8 @@ production: <<: *default pool: active: true + interval: 30 + maximum_refill_count: 30 workspace_root: <%= Rails.root.join('tmp', 'files', Rails.env) %> test: diff --git a/spec/lib/docker_container_pool_spec.rb b/spec/lib/docker_container_pool_spec.rb index 2b322f27..792fa14d 100644 --- a/spec/lib/docker_container_pool_spec.rb +++ b/spec/lib/docker_container_pool_spec.rb @@ -82,6 +82,14 @@ describe DockerContainerPool do end describe '.refill' do + let(:config) { double } + let(:maximum_refill_count) { 5 } + + before(:each) do + expect(DockerContainerPool).to receive(:config).and_return(config) + expect(config).to receive(:[]).with(:maximum_refill_count).and_return(maximum_refill_count) + end + after(:each) { DockerContainerPool.refill } it 'regards all execution environments' do @@ -91,11 +99,9 @@ describe DockerContainerPool do end context 'with something to refill' do - let(:maximum_refill_count) { 5 } before(:each) { @execution_environment.update(pool_size: 10) } it 'complies with the maximum batch size' do - expect(DockerContainerPool::config).to receive(:[]).with(:maximum_refill_count).and_return(maximum_refill_count) expect_any_instance_of(Concurrent::Future).to receive(:execute) do |future| expect(DockerContainerPool).to receive(:create_container).with(@execution_environment).exactly(maximum_refill_count).times future.instance_variable_get(:@task).call