fixed Docker configuration
This commit is contained in:
@ -2,8 +2,6 @@ default: &default
|
|||||||
connection_timeout: 3
|
connection_timeout: 3
|
||||||
pool:
|
pool:
|
||||||
active: false
|
active: false
|
||||||
interval: 15
|
|
||||||
maximum_refill_count: 32
|
|
||||||
ports: !ruby/range 4500..4600
|
ports: !ruby/range 4500..4600
|
||||||
|
|
||||||
development:
|
development:
|
||||||
@ -15,6 +13,8 @@ production:
|
|||||||
<<: *default
|
<<: *default
|
||||||
pool:
|
pool:
|
||||||
active: true
|
active: true
|
||||||
|
interval: 30
|
||||||
|
maximum_refill_count: 30
|
||||||
workspace_root: <%= Rails.root.join('tmp', 'files', Rails.env) %>
|
workspace_root: <%= Rails.root.join('tmp', 'files', Rails.env) %>
|
||||||
|
|
||||||
test:
|
test:
|
||||||
|
@ -82,6 +82,14 @@ describe DockerContainerPool do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe '.refill' do
|
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 }
|
after(:each) { DockerContainerPool.refill }
|
||||||
|
|
||||||
it 'regards all execution environments' do
|
it 'regards all execution environments' do
|
||||||
@ -91,11 +99,9 @@ describe DockerContainerPool do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context 'with something to refill' do
|
context 'with something to refill' do
|
||||||
let(:maximum_refill_count) { 5 }
|
|
||||||
before(:each) { @execution_environment.update(pool_size: 10) }
|
before(:each) { @execution_environment.update(pool_size: 10) }
|
||||||
|
|
||||||
it 'complies with the maximum batch size' do
|
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_any_instance_of(Concurrent::Future).to receive(:execute) do |future|
|
||||||
expect(DockerContainerPool).to receive(:create_container).with(@execution_environment).exactly(maximum_refill_count).times
|
expect(DockerContainerPool).to receive(:create_container).with(@execution_environment).exactly(maximum_refill_count).times
|
||||||
future.instance_variable_get(:@task).call
|
future.instance_variable_get(:@task).call
|
||||||
|
Reference in New Issue
Block a user