rspec-puppet does not support file_line resource -
i have below manifests file_line resource
class login { if $::operatingsystemmajrelease < 7 { file {'/etc/loginfile': ensure => present, } file_line { 'testfile': path => '/etc/loginfile', line => 'abc 022', match => '^abc.*$', } } }
below rspec file
require 'spec_helper' describe 'login' { should contain_class('login')} let(:facts) {{:operatingsystemmajrelease => 6}} if (6 < 7) { should contain_file('/etc/loginfile').with_ensure('present')} { should contain_file_line('testfile').with( :path => '/etc/loginfile', :line => 'abc 022', :match => '^abc.*$' )} end end
when run rake-spec command getting below error
login failure/error: { should contain_class('login')} puppet::error: puppet::parser::ast::resource failed error argumenterror: invalid resource type file_line @ /etc/puppetlabs/modulename/login/spec/fixtures/modules/login_defs/manifests/init.pp:17 on node # ./spec/classes/login_spec.rb:5
rspec not support file_line resporce?
becase if remove "file_line" resource , run rsepc file working
file_line in puppetlabs-stdlib, need include test fixture.
easiest way in .fixtures.yml:
fixtures: repositories: stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib"
Comments
Post a Comment