mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
Merge pull request #270 from mattkirby/no_duplicate_vms_in_pool
Do not run duplicate instances of inventory check for a pool
This commit is contained in:
commit
69f8b21ca8
2 changed files with 37 additions and 12 deletions
|
|
@ -2693,6 +2693,7 @@ EOT
|
|||
let(:pool_object) { config[:pools][0] }
|
||||
let(:new_vm) { 'newvm'}
|
||||
let(:pool_name) { pool_object['name'] }
|
||||
let(:mutex) { Mutex.new }
|
||||
|
||||
before do
|
||||
expect(subject).not_to be_nil
|
||||
|
|
@ -2798,6 +2799,27 @@ EOT
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
it 'should get the pool mutex' do
|
||||
expect(subject).to receive(:pool_mutex).and_return(mutex).at_least(:once)
|
||||
|
||||
subject._check_pool(pool_object,provider)
|
||||
end
|
||||
|
||||
it 'should run synchronize' do
|
||||
expect(subject).to receive(:pool_mutex).and_return(mutex).at_least(:once)
|
||||
expect(mutex).to receive(:synchronize).at_least(:once)
|
||||
|
||||
subject._check_pool(pool_object,provider)
|
||||
end
|
||||
|
||||
it 'should yield when locked' do
|
||||
expect(subject).to receive(:pool_mutex).and_return(mutex).at_least(:once)
|
||||
mutex.lock
|
||||
expect(mutex).to receive(:synchronize).and_yield
|
||||
|
||||
subject._check_pool(pool_object,provider)
|
||||
end
|
||||
end
|
||||
|
||||
# RUNNING
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue