On 6/7/14, 3:11 PM, Werner Dijkerman wrote:
> 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
>
Hi Werner,
You do not actually need to use getvar() as the following should work.
$include_dir = $zabbix::params::agent_include
If you could send a link to your module, I'd be happy to have a look.
Best regards,
-g
--
Garrett Honeycutt
@learnpuppet
Puppet Training with LearnPuppet.com
Mobile: +1.206.414.8658
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/5394952B.5060305%40garretthoneycutt.com.
For more options, visit https://groups.google.com/d/optout.