puppet-neutron/spec/unit/type/neutron_plugin_opencontrail_spec.rb
Yanis Guenane 2c21af85da Rely on autorequire for config resource ordering
Currently we specify the ordering of config resources wherever it is
necessary based on the presence of the file it will write to, or the
presence of the package in charge of providing the file it will write
to.

Those kind of ordering can be specified directly at the resource level
using the autorequire mechanism. With this patch, any config resource
will make sure the package in charge of providing the file will be
installed first.

Change-Id: I5542165142516fcd8fd3969c24ca92ac221452bd
2015-09-07 12:59:06 +02:00

21 lines
763 B
Ruby

require 'puppet'
require 'puppet/type/neutron_plugin_opencontrail'
describe 'Puppet::Type.type(:neutron_plugin_opencontrail)' do
before :each do
@neutron_plugin_opencontrail = Puppet::Type.type(:neutron_plugin_opencontrail).new(:name => 'DEFAULT/foo', :value => 'bar')
end
it 'should autorequire the package that install the file' do
catalog = Puppet::Resource::Catalog.new
package = Puppet::Type.type(:package).new(:name => 'neutron-plugin-opencontrail')
catalog.add_resource package, @neutron_plugin_opencontrail
dependency = @neutron_plugin_opencontrail.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@neutron_plugin_opencontrail)
expect(dependency[0].source).to eq(package)
end
end