1 If you follow these contributing guidelines your patch
2 will likely make it into a release a little quicker.
9 2. Run the tests. We only take pull requests with passing tests, and
10 it's great to know that you have a clean slate.
12 3. Add a test for your change. Only refactoring and documentation
13 changes require no new tests. If you are adding functionality
14 or fixing a bug, please add a test.
16 4. Make the test pass.
18 5. Push to your fork and submit a pull request.
23 The testing and development tools have a bunch of dependencies,
24 all managed by [Bundler](http://bundler.io/) according to the
25 [Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions).
27 By default the tests use a baseline version of Puppet.
29 If you have Ruby 2.x or want a specific version of Puppet,
30 you must set an environment variable such as:
32 export PUPPET_VERSION="~> 3.2.0"
34 Install the dependencies like so...
40 The test suite will run [Puppet Lint](http://puppet-lint.com/) and
41 [Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to
42 check various syntax and style things. You can run these locally with:
45 bundle exec rake syntax
47 ## Running the unit tests
49 The unit test suite covers most of the code. As mentioned above, please
50 add tests if you're adding new functionality. Running the test suite is done
55 Note also you can run the syntax, style and unit tests in one go with:
59 ### Automatically run the tests
61 During development of your puppet module you might want to run your unit
62 tests a couple of times. You can use the following command to automate
63 running the unit tests on every change made in the manifests folder.
69 The unit tests just check the code runs, not that it does exactly what
70 we want on a real machine. For that we're using
71 [Beaker](https://github.com/puppetlabs/beaker).
73 Beaker fires up a new virtual machine (using Vagrant) and runs a series of
74 simple tests against it after applying the module. You can run our Beaker
77 bundle exec rake acceptance
79 This will use the host described in `spec/acceptance/nodeset/default.yml`
80 by default. To run against another host, set the `RS_SET` environment
81 variable to the name of a host described by a `.yml` file in the
82 `nodeset` directory. For example, to run against Fedora 20:
84 RS_SET=fedora-20-x64 bundle exec rake acceptance
86 If you don't want to have to recreate the virtual machine every time you
87 can use `BEAKER_DESTROY=no` and `BEAKER_PROVISION=no`. On the first run you will
88 at least need `BEAKER_PROVISION` set to yes (the default). The Vagrantfile
89 for the created virtual machines will be in `.vagrant/beaker_vagrant_files`.