The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com
Improve procedure for enabling rspec tests in modules
|Affected Puppet version:||0.25.4||Branch:|
Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com
This ticket may be automatically exported to the PUP project on JIRA using the button below:
I’m logging this at the request of James Turnbull:
I’ve recently started on my first puppet custom type/provider, and decided to try to do this a) in a module, and b) with rspec tests.
I was able to get spec tests running, but with quite a bit of hackery, copying files from the main puppet repo:
test/lib test/lib/puppettest test/lib/puppettest/certificates.rb test/lib/puppettest/exetest.rb test/lib/puppettest/fakes.rb test/lib/puppettest/fileparsing.rb test/lib/puppettest/filetesting.rb test/lib/puppettest/parsertesting.rb test/lib/puppettest/railstesting.rb test/lib/puppettest/reporttesting.rb test/lib/puppettest/resourcetesting.rb test/lib/puppettest/runnable_test.rb test/lib/puppettest/servertest.rb test/lib/puppettest/support test/lib/puppettest/support/assertions.rb test/lib/puppettest/support/collection.rb test/lib/puppettest/support/helpers.rb test/lib/puppettest/support/resources.rb test/lib/puppettest/support/utils.rb test/lib/puppettest/support.rb test/lib/puppettest/testcase.rb test/lib/puppettest.rb
Honestly, I haven’t worked out which of these libs are totally required, but puppettest.rb is at a minimum. (puppettest/runnable_test.rb seems to be unrequired so far, except for being called in spec_helper.rb)
Is there a way that this can be made easier? Developing types in modules seems to be a sensible way to go after all – it should allow folk on any client version to add a new type, rather than requiring they upgrade to puppet-latest.
My vcsrepo module (based now on James' tutorial at http://www.kartar.net/2010/02/puppet-types-and-providers-are-easy/ btw) is located at:
Naturally, i’m more than happy to help with this work, but my knowledge of the puppet codebase and Rspec framework is very limited.
#2 Updated by Luke Kanies about 4 years ago
- Status changed from Needs Decision to Accepted
- Assignee deleted (
I definitely think this is a good idea, but I think overall it’s probably best within the context of a tool like gepetto – you have something on your system that expects a given convention, and that thing makes modules that follow the convention easy to test.