
... to avoid redundant parsing of json content from a given string. This also allows us to add more strict validation later using Struct data type. Change-Id: I2a8bbd266d5e97a06b89c131bbd86e3710a68923
60 lines
1.5 KiB
Ruby
60 lines
1.5 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe 'nova::pci' do
|
|
|
|
shared_examples_for 'nova-pci' do
|
|
context 'with default parameters' do
|
|
it 'clears pci_alias configuration' do
|
|
is_expected.to contain_nova_config('pci/alias').with(:value => '<SERVICE DEFAULT>')
|
|
end
|
|
end
|
|
|
|
context 'with aliases array' do
|
|
let :params do
|
|
{
|
|
:aliases => [{
|
|
"vendor_id" => "8086",
|
|
"product_id" => "0126",
|
|
"name" => "graphic_card"
|
|
},
|
|
{
|
|
"vendor_id" => "9096",
|
|
"product_id" => "1520",
|
|
"name" => "network_card"
|
|
}
|
|
]
|
|
}
|
|
end
|
|
it 'configures nova pci_alias entries' do
|
|
is_expected.to contain_nova_config('pci/alias').with(
|
|
'value' => ['{"vendor_id":"8086","product_id":"0126","name":"graphic_card"}','{"vendor_id":"9096","product_id":"1520","name":"network_card"}']
|
|
)
|
|
end
|
|
end
|
|
|
|
context 'when aliases is empty' do
|
|
let :params do
|
|
{
|
|
:aliases => []
|
|
}
|
|
end
|
|
|
|
it 'clears pci_alias configuration' do
|
|
is_expected.to contain_nova_config('pci/alias').with(:value => '<SERVICE DEFAULT>')
|
|
end
|
|
end
|
|
end
|
|
|
|
on_supported_os({
|
|
:supported_os => OSDefaults.get_supported_os
|
|
}).each do |os,facts|
|
|
context "on #{os}" do
|
|
let (:facts) do
|
|
facts.merge!(OSDefaults.get_facts())
|
|
end
|
|
|
|
it_configures 'nova-pci'
|
|
end
|
|
end
|
|
end
|