mirror of
https://github.com/puppetlabs/vmpooler-provider-vsphere.git
synced 2026-01-26 11:28:40 -05:00
Fix getting IP by not returning a bad address
This commit is contained in:
parent
7822b2182e
commit
f02e0eb19a
3 changed files with 34 additions and 2 deletions
|
|
@ -580,11 +580,41 @@ EOT
|
|||
end
|
||||
end
|
||||
|
||||
context 'when VM exists but contains a self assigned ip' do
|
||||
let(:vm_object) { mock_RbVmomi_VIM_VirtualMachine({
|
||||
:name => vmname,
|
||||
:ip => '169.254.255.255',
|
||||
})
|
||||
}
|
||||
|
||||
it 'should return nil ip' do
|
||||
allow(subject).to receive(:sleep)
|
||||
result = subject.get_vm(poolname,vmname)
|
||||
|
||||
expect(result['ip']).to eq(nil)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when VM exists but contains an invalid ip' do
|
||||
let(:vm_object) { mock_RbVmomi_VIM_VirtualMachine({
|
||||
:name => vmname,
|
||||
:ip => '0.0.0.0',
|
||||
})
|
||||
}
|
||||
|
||||
it 'should return nil for ip' do
|
||||
allow(subject).to receive(:sleep)
|
||||
result = subject.get_vm(poolname,vmname)
|
||||
|
||||
expect(result['ip']).to eq(nil)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when VM exists and contains all information' do
|
||||
let(:vm_hostname) { "#{vmname}.demo.local" }
|
||||
let(:boot_time) { Time.now }
|
||||
let(:power_state) { 'MockPowerState' }
|
||||
let(:ip) { '169.254.255.255' }
|
||||
let(:ip) { '192.168.0.2' }
|
||||
|
||||
let(:vm_object) { mock_RbVmomi_VIM_VirtualMachine({
|
||||
:name => vmname,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue