Reputation: 1232
I'm trying to get rspec to work on my Puppet module, but I get this error:
1) apache when called with no parameters on redhat
Failure/Error: })
Puppet::Error:
Could not parse for environment production: No file(s) found for import of '' at line 4 on node testhost.example.com
# ./spec/classes/apache_spec.rb:10:in `block (3 levels) in <top (required)>'
I have run puppet-rspec-init and put a simple spec in spec/classes/apache_spec.rb
This is the part that I'm most curious about; what is it trying to load?
No file(s) found for import of '' at line 4
I do have a .fixtures.yml in place (modules/apache/.fixtures.yml):
fixtures:
symlinks:
"apache": "#{source_dir}"
Could someone nudge me in the right direction? I've probably missed something obvious... :S
Thanks, Ger.
Upvotes: 0
Views: 828
Reputation: 1232
Some code changes in PE 3.2 requires that I do this before a 'rake spec'
export MODULEPATH=/etc/puppetlabs/puppet/modules
Thanks to Ben from PuppetLabs.
Upvotes: 1
Reputation: 81
I've seen a similarly phrased error when I didn't have a site.pp file in fixtures, though I haven't been able to duplicate that problem. If you haven't already, get your first spec running with just
it { should compile.with_all_deps }
...before you write any additional tests. Just getting the tools set up to work right (and keeping up with changes) is a lot harder than writing the tests; the tests are the easy part. The .fixtures file should create the symlink for you when you run the appropriate rake task, but if it doesn't, make sure your module is symlinked in fixtures, as well as any dependent modules symlinked as well.
I like puppetlabs_spec_helper alongside rspec-puppet, though you end up with rake spec and rake rspec both available, one or the other of which may not work quite right.
Upvotes: 1