refill Docker container pool in small batches

This commit is contained in:
Hauke Klement
2015-02-11 15:48:06 +01:00
parent e39d715b57
commit 1226eb9d24
3 changed files with 13 additions and 3 deletions

View File

@ -91,7 +91,16 @@ describe DockerContainerPool do
end
context 'with something to refill' do
before(:each) { @execution_environment.update(pool_size: 1) }
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
end
end
it 'works asynchronously' do
expect(Concurrent::Future).to receive(:execute)