1 This module has grown over time based on a range of contributions from
2 people using it. If you follow these contributing guidelines your patch
3 will likely make it into a release a little quicker.
10 2. Run the tests. We only take pull requests with passing tests, and
11 it's great to know that you have a clean slate
13 3. Add a test for your change. Only refactoring and documentation
14 changes require no new tests. If you are adding functionality
15 or fixing a bug, please add a test.
17 4. Make the test pass.
19 5. Push to your fork and submit a pull request.
24 The testing and development tools have a bunch of dependencies,
25 all managed by [bundler](http://bundler.io/) according to the
26 [Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions).
28 By default the tests use a baseline version of Puppet.
30 If you have Ruby 2.x or want a specific version of Puppet,
31 you must set an environment variable such as:
33 export PUPPET_VERSION="~> 3.2.0"
35 Install the dependencies like so...
41 The test suite will run [Puppet Lint](http://puppet-lint.com/) and
42 [Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to
43 check various syntax and style things. You can run these locally with:
46 bundle exec rake syntax
48 ## Running the unit tests
50 The unit test suite covers most of the code, as mentioned above please
51 add tests if you're adding new functionality. If you've not used
52 [rspec-puppet](http://rspec-puppet.com/) before then feel free to ask
53 about how best to test your new feature. Running the test suite is done
58 Note also you can run the syntax, style and unit tests in one go with:
62 ### Automatically run the tests
64 During development of your puppet module you might want to run your unit
65 tests a couple of times. You can use the following command to automate
66 running the unit tests on every change made in the manifests folder.
72 The unit tests just check the code runs, not that it does exactly what
73 we want on a real machine. For that we're using
74 [beaker](https://github.com/puppetlabs/beaker).
76 This fires up a new virtual machine (using vagrant) and runs a series of
77 simple tests against it after applying the module. You can run this
80 bundle exec rake acceptance
82 This will run the tests on an CentOS 6.5 virtual machine.
84 If you don't want to have to recreate the virtual machine every time you
85 can use `BEAKER_DESTROY=no` and `BEAKER_PROVISION=no`. On the first run you will
86 at least need `BEAKER_PROVISION` set to yes (the default). The Vagrantfile
87 for the created virtual machines will be in `.vagrant/beaker_vagrant_files`.