(POOLER-70) Rename conflicting method in vSphere Provider

Previously, the vSphere Provider had two methods called
`find_least_used_compatible_host`: one in the base class and one in the vSphere
helper methods.  This commit renames the vSphere helper methods and tests to
`find_least_used_vsphere_compatible_host` to stop the conflict.
This commit is contained in:
Glenn Sarti 2017-03-22 09:04:16 -07:00
parent 8cf3d043bf
commit e5db02b44f
2 changed files with 1919 additions and 1919 deletions

View file

@ -265,7 +265,7 @@ module Vmpooler
cluster_hosts cluster_hosts
end end
def find_least_used_compatible_host(vm) def find_least_used_vpshere_compatible_host(vm)
ensure_connected @connection, @credentials ensure_connected @connection, @credentials
source_host = vm.summary.runtime.host source_host = vm.summary.runtime.host

View file

@ -107,6 +107,7 @@ EOT
expect(subject.vm_exists?('vm')).to eq(false) expect(subject.vm_exists?('vm')).to eq(false)
end end
end
# vSphere helper methods # vSphere helper methods
let(:credentials) { config[:vsphere] } let(:credentials) { config[:vsphere] }
@ -1389,7 +1390,7 @@ EOT
end end
end end
describe '#find_least_used_compatible_host' do describe '#find_least_used_vpshere_compatible_host' do
let(:vm) { mock_RbVmomi_VIM_VirtualMachine() } let(:vm) { mock_RbVmomi_VIM_VirtualMachine() }
before(:each) do before(:each) do
@ -1407,7 +1408,7 @@ EOT
end end
it 'should return the standalone host' do it 'should return the standalone host' do
result = subject.find_least_used_compatible_host(vm) result = subject.find_least_used_vpshere_compatible_host(vm)
expect(result).to_not be_nil expect(result).to_not be_nil
expect(result[0]).to be(standalone_host) expect(result[0]).to be(standalone_host)
@ -1417,7 +1418,7 @@ EOT
it 'should ensure the connection' do it 'should ensure the connection' do
expect(subject).to receive(:ensure_connected) expect(subject).to receive(:ensure_connected)
result = subject.find_least_used_compatible_host(vm) result = subject.find_least_used_vpshere_compatible_host(vm)
end end
end end
@ -1433,7 +1434,7 @@ EOT
end end
it 'should raise error' do it 'should raise error' do
expect{subject.find_least_used_compatible_host(vm)}.to raise_error(NoMethodError,/undefined method/) expect{subject.find_least_used_vpshere_compatible_host(vm)}.to raise_error(NoMethodError,/undefined method/)
end end
end end
@ -1451,7 +1452,7 @@ EOT
end end
it 'should return the least used host' do it 'should return the least used host' do
result = subject.find_least_used_compatible_host(vm) result = subject.find_least_used_vpshere_compatible_host(vm)
expect(result).to_not be_nil expect(result).to_not be_nil
expect(result[0]).to be(expected_host) expect(result[0]).to be(expected_host)
@ -1461,7 +1462,7 @@ EOT
it 'should ensure the connection' do it 'should ensure the connection' do
expect(subject).to receive(:ensure_connected) expect(subject).to receive(:ensure_connected)
result = subject.find_least_used_compatible_host(vm) result = subject.find_least_used_vpshere_compatible_host(vm)
end end
end end
@ -1479,7 +1480,7 @@ EOT
end end
it 'should raise error' do it 'should raise error' do
expect{subject.find_least_used_compatible_host(vm)}.to raise_error(NoMethodError,/undefined method/) expect{subject.find_least_used_vpshere_compatible_host(vm)}.to raise_error(NoMethodError,/undefined method/)
end end
end end
@ -1499,7 +1500,7 @@ EOT
end end
it 'should return the least used host' do it 'should return the least used host' do
result = subject.find_least_used_compatible_host(vm) result = subject.find_least_used_vpshere_compatible_host(vm)
expect(result).to_not be_nil expect(result).to_not be_nil
expect(result[0]).to be(expected_host) expect(result[0]).to be(expected_host)
@ -1509,7 +1510,7 @@ EOT
it 'should ensure the connection' do it 'should ensure the connection' do
expect(subject).to receive(:ensure_connected) expect(subject).to receive(:ensure_connected)
result = subject.find_least_used_compatible_host(vm) result = subject.find_least_used_vpshere_compatible_host(vm)
end end
end end
@ -1528,7 +1529,7 @@ EOT
it 'should return a host' do it 'should return a host' do
pending('https://github.com/puppetlabs/vmpooler/issues/206 is fixed') pending('https://github.com/puppetlabs/vmpooler/issues/206 is fixed')
result = subject.find_least_used_compatible_host(vm) result = subject.find_least_used_vpshere_compatible_host(vm)
expect(result).to_not be_nil expect(result).to_not be_nil
end end
@ -1537,7 +1538,7 @@ EOT
pending('https://github.com/puppetlabs/vmpooler/issues/206 is fixed') pending('https://github.com/puppetlabs/vmpooler/issues/206 is fixed')
expect(subject).to receive(:ensure_connected) expect(subject).to receive(:ensure_connected)
result = subject.find_least_used_compatible_host(vm) result = subject.find_least_used_vpshere_compatible_host(vm)
end end
end end
end end
@ -2185,5 +2186,4 @@ EOT
end end
end end
end end
end
end end