mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -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,11 +1270,13 @@ module Vmpooler
|
||||||
$metrics.gauge("ready.#{pool_name}", ready)
|
$metrics.gauge("ready.#{pool_name}", ready)
|
||||||
$metrics.gauge("running.#{pool_name}", running)
|
$metrics.gauge("running.#{pool_name}", running)
|
||||||
|
|
||||||
if redis.get("vmpooler__empty__#{pool_name}")
|
unless pool_size == 0
|
||||||
redis.del("vmpooler__empty__#{pool_name}") unless ready == 0
|
if redis.get("vmpooler__empty__#{pool_name}")
|
||||||
elsif ready == 0
|
redis.del("vmpooler__empty__#{pool_name}") unless ready == 0
|
||||||
redis.set("vmpooler__empty__#{pool_name}", 'true')
|
elsif ready == 0
|
||||||
$logger.log('s', "[!] [#{pool_name}] is empty")
|
redis.set("vmpooler__empty__#{pool_name}", 'true')
|
||||||
|
$logger.log('s', "[!] [#{pool_name}] is empty")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
(pool_size - total.to_i).times do
|
(pool_size - total.to_i).times do
|
||||||
|
|
|
||||||
|
|
@ -4120,7 +4120,7 @@ EOT
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#repopulate_pool_vms' do
|
describe '#repopulate_pool_vms' do
|
||||||
let(:pool_size) { 0 }
|
let(:pool_size) { 1 }
|
||||||
let(:config) {
|
let(:config) {
|
||||||
YAML.load(<<-EOT
|
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
|
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
|
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
|
end
|
||||||
|
|
||||||
it 'should not call clone_vm when number of VMs is greater than the pool size' do
|
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)
|
subject.repopulate_pool_vms(pool, provider, pool_check_response, pool_size)
|
||||||
end
|
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
|
context 'when pool is marked as empty' do
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue