1 # Contributing to the OpenDaylight Puppet Module
3 We work to make contributing easy. Please let us know if you spot something we can do better.
6 1. [Overview](#overview)
7 1. [Communication](#communication)
10 1. [Patches](#patches)
11 1. [Testing](#testing)
12 * [Test Dependencies](#test-dependencies)
13 * [Syntax and Style Tests](#syntax-and-style-tests)
14 * [Unit Tests](#unit-tests)
15 * [System Tests](#system-tests)
19 We use [GitHub Issues](https://github.com/dfarrell07/puppet-opendaylight/issues) for most communication, including bug reports, feature requests and questions.
21 We accept patches via [GitHub Pull Requests](https://github.com/dfarrell07/puppet-opendaylight/pulls). Please fork our repo, make your changes, commit them to a feature branch and *submit a PR to have it merged back into this project*. We'll give feedback and get it merged ASAP.
25 Please use public, documented communication instead of reaching out to developers 1-1.
27 Open Source projects benefit from always communicating in the open. Other people may run into the same issue, search for a similar trace and find your question, already answered. More eyes may even get your question answered faster.
29 We prefer [Issues](https://github.com/dfarrell07/puppet-opendaylight/issues) for most communication.
33 Please use our [GitHub Issues](https://github.com/dfarrell07/puppet-opendaylight/issues) freely, even for small things! They are the primary method by which we track what's going on in the project.
35 The labels assigned to an issue can tell you important things about it.
37 For example, issues tagged [`good-for-beginners`](https://github.com/dfarrell07/puppet-opendaylight/labels/good-for-beginners) are likely to not require much background knowledge and be fairly self-contained, perfect for people new to the project who are looking to get involved.
39 The priority-related issue labels ([`prio:high`](https://github.com/dfarrell07/puppet-opendaylight/labels/prio%3Ahigh), [`piro:normal`](https://github.com/dfarrell07/puppet-opendaylight/labels/prio%3Anormal)...) are also important to note. They typically accurately reflect the next TODOs the community will complete.
41 The `info:progress` labels may not always be up-to-date, but will be used when appropriate (typically long-standing issues that take multiple commits).
43 Issues can be referenced and manipulated from git commit messages. Just referencing the issue's number (`#42`) will link the commit and issue. Issues can also be closed from commit messages with `closes #42` (and [a variety of other key words](https://help.github.com/articles/closing-issues-via-commit-messages/)).
47 We're experimenting with Gitter, a GitHub-driven chat service that works on a per-repo basis.
49 Feel free to hop in [our room](https://gitter.im/dfarrell07/puppet-opendaylight) and test it out with us.
53 Please use [Pull Requests](https://github.com/dfarrell07/puppet-opendaylight/pulls) to submit patches.
55 Basics of a pull request:
56 * Use the GitHub web UI to fork our repo.
57 * Clone your fork to your local system.
59 * Commit your changes, using a good commit message and referencing any applicable issues.
61 * Submit a pull request against the project, again using GitHub's web UI.
62 * We'll give feedback and get your changed merged ASAP.
63 * You contributed! Thank you!
65 Other tips for submitting excellent pull requests:
66 * If you'd like to make more than one logically distinct change, please submit them as different pull requests (if they don't depend on each other) or different commits in the same PR (if they do).
67 * If your PR contains a number of commits that provide one logical change, please squash them using `git rebase`.
68 * Please provide test coverage for your changes.
69 * If applicable, please provide documentation updates to reflect your changes.
75 The testing tools have a number of dependencies. We use [Bundler](http://bundler.io/) to make installing them easy.
78 [~/puppet-opendaylight]$ bundle install
81 ### Syntax and Style Tests
83 We use [Puppet Lint](http://puppet-lint.com/) and [Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to validate the module's syntax and style.
86 [~/puppet-opendaylight]$ bundle exec rake lint
87 [~/puppet-opendaylight]$ bundle exec rake syntax
92 We use rspec-puppet to provide unit test coverage.
94 To run the unit tests and generate a coverage report, use:
97 [~/puppet-opendaylight]$ bundle exec rake spec
99 Finished in 10.08 seconds (files took 0.50776 seconds to load)
100 537 examples, 0 failures
104 Touched resources: 19
105 Resource coverage: 100.00%
108 Note that we have a very large number of tests and 100% test coverage.
110 To run the syntax, style and unit tests in one rake task (recommended), use:
113 [~/puppet-opendaylight]$ bundle exec rake test
118 While the [unit tests](#unit-tests) are able to quickly find many errors, they don't do much more than checking that the code compiles to a given state. To verify that the Puppet module behaves as desired once applied to a real, running system, we use [Beaker](https://github.com/puppetlabs/beaker).
120 Beaker stands up virtual machines using Vagrant, applies the OpenDaylight puppet module with various combinations of params and uses [Serverspec](http://serverspec.org/resource_types.html) to validate the resulting system state.
122 To run our Beaker test against the primary target OS (CentOS 7) using the recommended RPM-based install method:
125 [~/puppet-opendaylight]$ bundle exec rake beaker
128 The `RS_SET` environment variable can be use to change Beaker's target OS (Fedora 20, Fedora 21, CentOS 7, Ubuntu 14.04). ODL's install method (RPM or tarball) can be configured via the `INSTALL_METHOD` environment variable.
131 [~/puppet-opendaylight]$ RS_SET=fedora-20 INSTALL_METHOD=tarball bundle exec rake beaker
134 There are a number of pre-defined rake tasks to simplify running common Beaker tests.
137 [~/puppet-opendaylight]$ bundle exec rake centos
138 [~/puppet-opendaylight]$ bundle exec rake centos_tarball
139 [~/puppet-opendaylight]$ bundle exec rake fedora_20
140 [~/puppet-opendaylight]$ bundle exec rake fedora_21
141 [~/puppet-opendaylight]$ bundle exec rake ubuntu
144 If you'd like to preserve the Beaker VM after a test run, perhaps for manual inspection or a quicker follow-up test run, use the `BEAKER_DESTROY` environment variable.
147 [~/puppet-opendaylight]$ BEAKER_DESTROY=no bundle exec rake centos
150 For more information about using Beaker, see [these docs](https://github.com/puppetlabs/beaker/wiki/How-to-Write-a-Beaker-Test-for-a-Module#typical-workflow).
152 ### Tests in Continuous Integration
154 We use [Travis CI](https://travis-ci.org/dfarrell07/puppet-opendaylight) to run our unit, syntax and style tests against a matrix of supported Ruby and Puppet versions at every commit. This currently results in >8500 automated tests per commit.