rspec-puppet not throwing error when hiera value change

asked 2015-09-14 07:08:33 -0600

Chutki gravatar image

Hi,

I have below test case written in rspec-puppet

require 'spec_helper'

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

  let(:hiera_config) { 'spec/fixtures/hiera/hiera.yaml' }
  hiera = Hiera.new({ :config => 'spec/fixtures/hiera/hiera.yaml' })

  tempa = hiera.lookup('lif_cyc::lif_cyc_line',nil,nil)

  let(:hiera_data) {{
    :lif_cyc_line => tempa
  }}

  it{ should contain_file('/tmp/lif_cyc').with(
        'ensure'  => 'file',
        'owner'   => 'root',
        'group'   => 'root',
        'mode'    => '0644',
        'conten'  =>  tempa
  ) }

end

and below is spec/fixtures/hiera/lif_cyc.yaml file

lif_cyc_line: 'production'

when I change to

lif_cyc_line: 'puppetlabs'

my test cases is working for the both the yaml value. but actual value is "lif_cyc_line: 'production'". I am wondering how test case running without any error when I chage it to "lif_cyc_line: 'puppetlabs'"

edit retag flag offensive close merge delete