mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 18:08:42 -05:00
Identify when a cloned VM is being checked for ready for a request that has been deleted
This commit is contained in:
parent
cebb118655
commit
dddbeba4a6
2 changed files with 25 additions and 0 deletions
|
|
@ -139,6 +139,9 @@ module Vmpooler
|
|||
if ondemandrequest_hash['status'] == 'failed'
|
||||
move_vm_queue(pool, vm, 'pending', 'completed', redis, "moved to completed queue. '#{request_id}' could not be filled in time")
|
||||
return nil
|
||||
elsif ondemandrequest_hash['status'] == 'deleted'
|
||||
move_vm_queue(pool, vm, 'pending', 'completed', redis, "moved to completed queue. '#{request_id}' has been deleted")
|
||||
return nil
|
||||
end
|
||||
pool_alias = redis.hget("vmpooler__vm__#{vm}", 'pool_alias')
|
||||
|
||||
|
|
|
|||
|
|
@ -358,6 +358,28 @@ EOT
|
|||
end
|
||||
end
|
||||
|
||||
context 'when the request has been marked as deleted' do
|
||||
before(:each) do
|
||||
redis_connection_pool.with do |redis|
|
||||
redis.hset("vmpooler__odrequest__#{request_id}", 'status', 'deleted')
|
||||
end
|
||||
end
|
||||
|
||||
it 'moves the vm to completed' do
|
||||
redis_connection_pool.with do |redis|
|
||||
expect(subject).to receive(:move_vm_queue).with(pool, vm, 'pending', 'completed', redis, "moved to completed queue. '#{request_id}' has been deleted")
|
||||
subject.move_pending_vm_to_ready(vm, pool, redis, request_id)
|
||||
end
|
||||
end
|
||||
|
||||
it 'returns nil' do
|
||||
redis_connection_pool.with do |redis|
|
||||
result = subject.move_pending_vm_to_ready(vm, pool, redis, request_id)
|
||||
expect(result).to be nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with auth on the request' do
|
||||
let(:user) { 'vmpuser' }
|
||||
let(:platform_alias) { pool }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue