require class name in rspec-puppet -
i have 2 different manifests files 1 define , other 1 normal manifests.
here use require classname
in normal manifests.
class bfile { require dummy if $::operatingsystemmajrelease > 5 { file {'/some/path/foo': ensure => present, owner => 'root', group => 'root', mode => '0644', } } }
i tried it {should contain_class('dummy')}
, it {should contain_require('dummy')}
,
but i'm getting "could not find class dummy on node"
error.
is there option available in puppet-rspec
check require classname
?
the error message could not find class dummy on node
might signify class dummy
not in modulepath
. it's recommended use absolute scope , modules: require ::my_module::dummy
. class should defined in:
modules/my_module/manifests/dummy.pp
regarding second part, require
cause puppet ensure every resource in bfile
class gets applied before every resource in dummy
class.
which means should able test way (rspec >= 3 syntax):
it { is_expected.to contain_file('/some/path/foo').that_requires('class[bfile]') }
Comments
Post a Comment