SumoLogic / sumologic-collector-puppet-module

Puppet module for installing Sumo Logic's collector.
Other
11 stars 22 forks source link

Introduce rspec-puppet and compile test for each class #14

Closed mcasper closed 8 years ago

mcasper commented 8 years ago

This PR adds the setup for rspec-puppet unit tests to the module, and adds a very simple "does the manifest compile" test for each class. I wanted to add all the setup in a separate PR so that it didn't get too bloated.

Puppet/rspec-puppet seem to have a fun bug revolving around Windows file paths in which Puppet won't correctly detect what kernel you're intending, and will complain that the Windows file path (which doesn't start with a /) is unqualified. I included a workaround in spec_helper.rb from a rspec-puppet thread about the issue.

https://github.com/rodjek/rspec-puppet/issues/192

Furthermore, a couple params weren't being passed properly to the *_config.pp classes, so I fixed those as well so the module can compile.

@duchatran We should get this running on CI as well, but I'll let you handle that.

mcasper commented 8 years ago

The command to run tests is bundle exec rake spec in case you need to override it.

duchatran commented 8 years ago

This is awesome, thanks @mcasper ! Indeed I am setting up TravisCI for the Chef repo, after that will move to this. Does Puppet has a framework like Chef Kitchen?

mcasper commented 8 years ago

@duchatran I'm not terribly familiar with Chef Kitchen, but from the little that I read about it, I don't think so. As I understand it, Chef Kitchen is about running your tests across different machine setups and test suites - and in Puppet, it's up to the tests to do that by stubbing out 'facts' to mimic being on different machine setups.