Rspec-puppet: left match operand must result in a string

229 views
Skip to first unread message

Anthony Scudese

unread,
Feb 1, 2018, 6:36:28 PM2/1/18
to Puppet Users
Hi all,

I've grown incredibly frustrated. So I'm trying to write some unit tests for my puppet modules. I've got PDK installed and running. My first test runs, "without params", but my second test fails due to a compilation error. Not sure what the real difference is between the two:

require 'spec_helper'

describe
'nuke', type: :class do
  let
(:facts) do
   
{
     
:userprofilepaths_array => ['C:\Users\foobar']
   
}
 
end

  context
'with no params' do
    it
{ should_not compile }
 
end

  context
'with nuke product' do
    let
(:params) do
     
{
       
:products  => {
         
'Nuke 9'  => {
           
'version'  => '9.0V5',
           
'package_source' => '/abs/path/to/nuke_installer.exe'
         
}
       
}
     
}
   
end

    it
{ should compile }
 
end
end

The error is:

failed: rspec: ./spec/classes/nuke_spec.rb:26: error during compilation: Evaluation Error: Left match operand must result in a String value. Got an Undef Value. at /Users/anthony/repos/puppetdev/nuke/spec/fixtures/modules/nuke/manifests/init.pp:30:7 on node anthonymbpro.local
  nuke with nuke product should compile into a catalogue without dependency cycles
  Failure/Error:
      end

      it { should compile }
    end
  end

 

Rob Nelson

unread,
Feb 1, 2018, 7:09:56 PM2/1/18
to puppet...@googlegroups.com
Can you share the contents of that file, or at least line 30 and a few before and after it?

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/582c5017-ef74-4ca8-894b-01ad6dcf5d19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Rob Nelson

Anthony Scudese

unread,
Feb 2, 2018, 9:33:07 PM2/2/18
to Puppet Users
Hey,

Unfortunately it seems to be a file that is autogenerated when I run
pdk test unit

. Is there a way I can stop the clean up process that happens? I'm new to rspec and pdk in general.

Thanks,
Anthony

David Schmitt

unread,
Feb 19, 2018, 8:03:46 AM2/19/18
to puppet...@googlegroups.com
Hi Anthony,

the file with the error should be your own `manifests/init.pp`, the path is just weird because of the additional setup required for the tests.


Cheers, David


For more options, visit https://groups.google.com/d/optout.
--
Reply all
Reply to author
Forward
0 new messages