mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Ensure all configured providers are loaded
Prior to this, providers that should have been loaded per the provider_class key of the providers hash were not actually loaded.
This commit is contained in:
parent
7872bfe8fc
commit
45378d46b9
2 changed files with 93 additions and 2 deletions
|
|
@ -75,6 +75,84 @@ EOT
|
|||
end
|
||||
end
|
||||
|
||||
describe '#used_providers' do
|
||||
context 'with no named providers' do
|
||||
let(:config) { YAML.load(<<-EOT
|
||||
---
|
||||
:config:
|
||||
:pools:
|
||||
- name: '#{pool}'
|
||||
size: 1
|
||||
provider: 'spoof'
|
||||
EOT
|
||||
)
|
||||
}
|
||||
it do
|
||||
result = ["dummy"]
|
||||
expect(subject.used_providers).to eq(result)
|
||||
end
|
||||
end
|
||||
context 'with one named provider without a provider_class key' do
|
||||
let(:config) { YAML.load(<<-EOT
|
||||
---
|
||||
:config:
|
||||
:providers:
|
||||
:mock:
|
||||
:pools:
|
||||
- name: '#{pool}'
|
||||
size: 1
|
||||
provider: 'spoof'
|
||||
EOT
|
||||
)
|
||||
}
|
||||
it do
|
||||
result = ["mock", "dummy"]
|
||||
expect(subject.used_providers).to eq(result)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with one named provider with a provider_class key' do
|
||||
let(:config) { YAML.load(<<-EOT
|
||||
---
|
||||
:config:
|
||||
:providers:
|
||||
:mock:
|
||||
provider_class: 'mock_mock'
|
||||
:pools:
|
||||
- name: '#{pool}'
|
||||
size: 1
|
||||
provider: 'spoof'
|
||||
EOT
|
||||
)
|
||||
}
|
||||
it do
|
||||
result = ["mock_mock", "dummy"]
|
||||
expect(subject.used_providers).to eq(result)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with one named provider with a provider_class key and one without' do
|
||||
let(:config) { YAML.load(<<-EOT
|
||||
---
|
||||
:config:
|
||||
:providers:
|
||||
:mock:
|
||||
provider_class: 'mock_mock'
|
||||
:foo:
|
||||
:pools:
|
||||
- name: '#{pool}'
|
||||
size: 1
|
||||
provider: 'spoof'
|
||||
EOT
|
||||
)
|
||||
}
|
||||
it do
|
||||
result = ["mock_mock", "foo", "dummy"]
|
||||
expect(subject.used_providers).to eq(result)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it '#default_providers' do
|
||||
expect(subject.default_providers).to eq(['dummy'])
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue