Hi there,
I'm busy with writing rspec tests for my zabbix module. But I've got one problem.
Within my 'define' I have the following:
$include_dir = getvar('zabbix::params::agent_include')
file { "${include_dir}/${name}.conf":
ensure => present,
owner => 'zabbix',
group => 'zabbix',
mode => '0755',
source => $source,
}
With this as my spec.rb file:
describe 'zabbix::userparameters' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '6.5',
:architecture => 'x86_64',
:lsbdistid => 'RedHat',
:concat_basedir => '/tmp'
}
end
let(:title) { 'mysql' }
let(:params) { { :source => 'puppet:///modules/zabbix/mysqld.conf' } }
it { should contain_file('/etc/zabbix/zabbix_agentd.d/mysql.conf').with_ensure('present') }
end
When I run rake spec, I've got the following message:
Failures:
1) zabbix::userparameters should contain File[/etc/zabbix/zabbix_agentd.d/mysql.conf] with ensure => "present"
Failure/Error: it { should contain_file('/etc/zabbix/zabbix_agentd.d/mysql.conf').with_ensure('present') }
expected that the catalogue would contain File[/etc/zabbix/zabbix_agentd.d/mysql.conf]
# ./spec/defines/userparameters_spec.rb:18:in `block (2 levels) in <top (required)>'
Finished in 0.26529 seconds
1 example, 1 failure
What am I missing.. ?
How do I set this 'include_dir' ?
Thanks in advance.
Kind regards,
Werner