(POOLER-128) Remove references to VM mutex when destroying

This commit updates destroy_vm to remove references to its mutex tracking object when destroyed. Without this change a VM that is destroyed will leave its mutex tracking object forever causing the pool manager memory footprint to increase.
This commit is contained in:
kirby@puppetlabs.com 2018-07-23 15:58:09 -07:00
parent 10bf6c8816
commit 490e5c1938
3 changed files with 39 additions and 0 deletions

View file

@ -726,6 +726,12 @@ EOT
subject._destroy_vm(vm,pool,provider)
end
it 'should dereference the mutex' do
expect(subject).to receive(:dereference_mutex)
subject._destroy_vm(vm,pool,provider)
end
end
context 'when the VM destruction raises an eror' do
@ -1690,6 +1696,26 @@ EOT
end
end
describe '#dereference_mutex' do
it 'should return nil when no mutex is dereferenced' do
expect(subject.dereference_mutex(vm)).to be_nil
end
it 'should return true when a mutex is dereferenced' do
subject.vm_mutex(vm)
expect(subject.dereference_mutex(vm)).to be true
end
it 'should dereference the mutex' do
mutex = subject.vm_mutex(vm)
subject.dereference_mutex(vm)
result = subject.vm_mutex(vm)
expect(result).to_not eq(mutex)
end
end
describe 'sync_pool_template' do
let(:old_template) { 'templates/old-template' }
let(:new_template) { 'templates/new-template' }