Werner Dijkerman
2014-Jun-07 19:11 UTC
[Puppet Users] puppet rspec fails when using stdlib getvar
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 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/7bc48063-670d-462d-81b4-05ea9717a684%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.