@@ -12,15 +12,19 @@ By participating in this project you agree to abide by its terms.
1212
13131 . Create a separate branch for your change.
1414
15- 1 . Run the tests. We only take pull requests with passing tests, and
16- documentation.
15+ 1 . We only take pull requests with passing tests, and documentation. [ travis-ci] ( http://travis-ci.org )
16+ runs the tests for us. You can also execute them locally. This is explained
17+ in a later section.
18+
19+ 1 . Checkout the docs we use to review a module. They provide some guidance for
20+ new code that might help you before you submit a pull request.
1721
18221 . Add a test for your change. Only refactoring and documentation
1923 changes require no new tests. If you are adding functionality
2024 or fixing a bug, please add a test.
2125
22261 . Squash your commits down into logical components. Make sure to rebase
23- against the current master.
27+ against our current master.
2428
25291 . Push the branch to your fork and submit a pull request.
2630
@@ -38,7 +42,9 @@ By default the tests use a baseline version of Puppet.
3842If you have Ruby 2.x or want a specific version of Puppet,
3943you must set an environment variable such as:
4044
41- export PUPPET_VERSION="~> 4.2.0"
45+ ``` sh
46+ export PUPPET_VERSION=" ~> 5.5.6"
47+ ```
4248
4349You can install all needed gems for spec tests into the modules directory by
4450running:
@@ -65,13 +71,17 @@ The test suite will run [Puppet Lint](http://puppet-lint.com/) and
6571[ Puppet Syntax] ( https://github.com/gds-operations/puppet-syntax ) to
6672check various syntax and style things. You can run these locally with:
6773
68- bundle exec rake lint
69- bundle exec rake validate
74+ ``` sh
75+ bundle exec rake lint
76+ bundle exec rake validate
77+ ```
7078
7179It will also run some [ Rubocop] ( http://batsov.com/rubocop/ ) tests
7280against it. You can run those locally ahead of time with:
7381
74- bundle exec rake rubocop
82+ ``` sh
83+ bundle exec rake rubocop
84+ ```
7585
7686## Running the unit tests
7787
@@ -82,15 +92,21 @@ about how best to test your new feature.
8292
8393To run the linter, the syntax checker and the unit tests:
8494
85- bundle exec rake test
95+ ``` sh
96+ bundle exec rake test
97+ ```
8698
8799To run your all the unit tests
88100
89- bundle exec rake spec SPEC_OPTS='--format documentation'
101+ ``` sh
102+ bundle exec rake spec
103+ ```
90104
91105To run a specific spec test set the ` SPEC ` variable:
92106
93- bundle exec rake spec SPEC=spec/foo_spec.rb
107+ ``` sh
108+ bundle exec rake spec SPEC=spec/foo_spec.rb
109+ ```
94110
95111## Integration tests
96112
@@ -102,23 +118,51 @@ This fires up a new virtual machine (using vagrant) and runs a series of
102118simple tests against it after applying the module. You can run this
103119with:
104120
105- bundle exec rake acceptance
121+ ``` sh
122+ bundle exec rake acceptance
123+ ```
106124
107125This will run the tests on the module's default nodeset. You can override the
108126nodeset used, e.g.,
109127
110- BEAKER_set=centos-7-x64 bundle exec rake acceptance
128+ ``` sh
129+ BEAKER_set=centos-7-x64 bundle exec rake acceptance
130+ ```
111131
112132There are default rake tasks for the various acceptance test modules, e.g.,
113133
114- bundle exec rake beaker:centos-7-x64
115- bundle exec rake beaker:ssh:centos-7-x64
134+ ``` sh
135+ bundle exec rake beaker:centos-7-x64
136+ bundle exec rake beaker:ssh:centos-7-x64
137+ ```
116138
117139If you don't want to have to recreate the virtual machine every time you can
118140use ` BEAKER_destroy=no ` and ` BEAKER_provision=no ` . On the first run you will at
119141least need ` BEAKER_provision ` set to yes (the default). The Vagrantfile for the
120142created virtual machines will be in ` .vagrant/beaker_vagrant_files ` .
121143
144+ Beaker also supports docker containers. We also use that in our automated CI
145+ pipeline at [ travis-ci] ( http://travis-ci.org ) . To use that instead of Vagrant:
146+
147+ ```
148+ PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker
149+ ```
150+
151+ You can replace the string ` debian9 ` with any common operating system.
152+ The following strings are known to work:
153+
154+ * ubuntu1604
155+ * ubuntu1804
156+ * debian8
157+ * debian9
158+ * centos6
159+ * centos7
160+
122161The easiest way to debug in a docker container is to open a shell:
123162
124- docker exec -it -u root ${container_id_or_name} bash
163+ ``` sh
164+ docker exec -it -u root ${container_id_or_name} bash
165+ ```
166+
167+ The source of this file is in our [ modulesync_config] ( https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb )
168+ repository.
0 commit comments