Ask Your Question
0

rspec-puppet doesn't support floor function

asked 2015-11-12 03:45:20 -0500

Chutki gravatar image

updated 2015-11-12 03:46:49 -0500

Hi,

I wrote rspec-puppet test case for below manifests

file { '/etc/sysctl.conf':
    ensure => present
  }
 $shmmni = floor($::memorysize_mb / 4)
 sysctl { 'kernel.shmmni':
    ensure    => present,
    permanent => 'yes',
    value     => $shmmni
  }

rspec-puppet sysctl_spec.rb

require 'spec_helper'

describe 'sysctl', :type => 'class' do

  it { should contain_file('/etc/sysctl.conf').with(
    :ensure => 'present'
  )}
end

when I run /opt/puppet/bin/rake rspec getting below error

 Failure/Error: )}
     Puppet::Error:
       Unknown function floor at /etc/puppetlabs/puppet/modules/mod_name/spec/fixtures/modules/mod_name/manifests/sysctl.pp:6 on node

below is my .fixtures.yml file

fixtures:
  symlinks:
    mod_name: "#{source_dir}"
    stdlib: "/etc/puppetlabs/puppet/modules/crp/stdlib"
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-11-12 04:07:20 -0500

Cristian Falcas gravatar image

Try this .fixtures.yml:

fixtures:
  repositories:
    stdlib: 'git://github.com/puppetlabs/puppetlabs-stdlib.git'
  symlinks:
    "your_module_name": "#{source_dir}"
edit flag offensive delete link more

Comments

I already downloaded stdlib module in my server, also I tried "stdlib: "/etc/puppetlabs/puppet/modules/crp/stdlib" for other modules file_line function and it worked

Chutki gravatar imageChutki ( 2015-11-12 10:27:17 -0500 )edit

You get the same error with the fixes from the fixtures file?

Cristian Falcas gravatar imageCristian Falcas ( 2015-11-12 11:19:37 -0500 )edit

yes I got same error only for floor function.

Chutki gravatar imageChutki ( 2015-11-12 23:01:42 -0500 )edit

the floor function worked after :/opt/puppet/bin/rake spec" but I am getting " Failure/Error: )} Puppet::Error: left operand of / is not a number at /etc/puppetlabs/puppet/modules/my_mod/spec/fixtures/modules/my_mod/manifests/sysctl.pp:6 on node rspec doesn't support special character

Chutki gravatar imageChutki ( 2015-11-13 10:47:20 -0500 )edit

Can you tell us the content of /etc/puppetlabs/puppet/modules/my_mod/spec/fixtures/modules/my_mod/manifests/sysctl.pp?

Cristian Falcas gravatar imageCristian Falcas ( 2015-11-15 12:33:28 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-11-12 03:45:20 -0500

Seen: 704 times

Last updated: Nov 12 '15