(POOLER-70) Update base VM provider

Previously the base VM provider class was added however it was missing various
functions from its definition.  This commit:
- Modifies the VMPooler configuration to add an empty provider config. if the
  provider config is missing
- Helper method to return all of the pools this provider is responsible for
This commit is contained in:
Glenn Sarti 2017-04-03 14:22:07 -07:00
parent 5aa5019822
commit 4bf32be87e
2 changed files with 45 additions and 6 deletions

View file

@ -84,7 +84,7 @@ EOT
)
}
context 'Given a misconfigured provider name' do
context 'Given a provider with no configuration' do
let(:config) { YAML.load(<<-EOT
---
:providers:
@ -94,8 +94,8 @@ EOT
EOT
)
}
it 'should return nil' do
expect(subject.provider_config).to be_nil
it 'should return empty hash' do
expect(subject.provider_config).to eq({})
end
end
@ -120,6 +120,26 @@ EOT
end
end
describe '#provided_pools' do
let(:config) { YAML.load(<<-EOT
---
:pools:
- name: 'pool1'
provider: 'base'
- name: 'pool2'
provider: 'base'
- name: 'otherpool'
provider: 'other provider'
- name: 'no name'
EOT
)
}
it "should return pools serviced by this provider" do
expect(subject.provided_pools).to eq(['pool1','pool2'])
end
end
describe '#vms_in_pool' do
it 'should raise error' do
expect{subject.vms_in_pool('pool')}.to raise_error(/does not implement vms_in_pool/)