| 1 |
require 'puppet' |
| 2 |
require 'puppet/type/qemu_config' |
| 3 |
|
| 4 |
describe 'Puppet::Type.type(:qemu_config)' do |
| 5 |
before :each do |
| 6 |
@qemu_config = Puppet::Type.type(:qemu_config).new(:name => 'DEFAULT/foo', :value => 'bar') |
| 7 |
end |
| 8 |
|
| 9 |
it 'should accept a valid value' do |
| 10 |
@qemu_config[:value] = 'bar' |
| 11 |
expect(@qemu_config[:value]).to eq('bar') |
| 12 |
end |
| 13 |
|
| 14 |
it 'should accept a valid value' do |
| 15 |
@qemu_config[:value] = 'bar' |
| 16 |
expect(@qemu_config[:value]).to eq('bar') |
| 17 |
end |
| 18 |
|
| 19 |
it 'should convert a boolean value (true)' do |
| 20 |
@qemu_config[:value] = true |
| 21 |
expect(@qemu_config[:value]).to eq('1') |
| 22 |
end |
| 23 |
|
| 24 |
it 'should autorequire the package that install the file' do |
| 25 |
catalog = Puppet::Resource::Catalog.new |
| 26 |
anchor = Puppet::Type.type(:anchor).new(:name => 'nova::install::end') |
| 27 |
catalog.add_resource anchor, @qemu_config |
| 28 |
dependency = @qemu_config.autorequire |
| 29 |
expect(dependency.size).to eq(1) |
| 30 |
expect(dependency[0].target).to eq(@qemu_config) |
| 31 |
expect(dependency[0].source).to eq(anchor) |
| 32 |
end |
| 33 |
|
| 34 |
end |