mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 18:08:42 -05:00
Remove pool empty messages for pools with a size of 0 configured
This commit is contained in:
parent
590c9a4c14
commit
18ca38b8db
2 changed files with 15 additions and 7 deletions
|
|
@ -1270,12 +1270,14 @@ module Vmpooler
|
|||
$metrics.gauge("ready.#{pool_name}", ready)
|
||||
$metrics.gauge("running.#{pool_name}", running)
|
||||
|
||||
unless pool_size == 0
|
||||
if redis.get("vmpooler__empty__#{pool_name}")
|
||||
redis.del("vmpooler__empty__#{pool_name}") unless ready == 0
|
||||
elsif ready == 0
|
||||
redis.set("vmpooler__empty__#{pool_name}", 'true')
|
||||
$logger.log('s', "[!] [#{pool_name}] is empty")
|
||||
end
|
||||
end
|
||||
|
||||
(pool_size - total.to_i).times do
|
||||
if redis.get('vmpooler__tasks__clone').to_i < $config[:config]['task_limit'].to_i
|
||||
|
|
|
|||
|
|
@ -4120,7 +4120,7 @@ EOT
|
|||
end
|
||||
|
||||
describe '#repopulate_pool_vms' do
|
||||
let(:pool_size) { 0 }
|
||||
let(:pool_size) { 1 }
|
||||
let(:config) {
|
||||
YAML.load(<<-EOT
|
||||
---
|
||||
|
|
@ -4139,7 +4139,7 @@ EOT
|
|||
it 'should not call clone_vm when number of VMs is equal to the pool size' do
|
||||
expect(subject).to receive(:clone_vm).exactly(0).times
|
||||
|
||||
subject.repopulate_pool_vms(pool, provider, pool_check_response, pool_size)
|
||||
subject.repopulate_pool_vms(pool, provider, pool_check_response, 0)
|
||||
end
|
||||
|
||||
it 'should not call clone_vm when number of VMs is greater than the pool size' do
|
||||
|
|
@ -4183,6 +4183,12 @@ EOT
|
|||
subject.repopulate_pool_vms(pool, provider, pool_check_response, pool_size)
|
||||
end
|
||||
|
||||
it 'should not log a message when the pool size is 0' do
|
||||
expect(logger).to_not receive(:log).with('s', "[!] [#{pool}] is empty")
|
||||
|
||||
subject.repopulate_pool_vms(pool, provider, pool_check_response, 0)
|
||||
end
|
||||
|
||||
context 'when pool is marked as empty' do
|
||||
|
||||
before(:each) do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue