@@ -12,15 +12,20 @@ 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 [ our docs] ( https://voxpupuli.org/docs/#reviewing-a-module-pr ) we
20+ use to review a module and the [ official styleguide] ( https://puppet.com/docs/puppet/6.0/style_guide.html ) .
21+ They provide some guidance for new code that might help you before you submit a pull request.
1722
18231 . Add a test for your change. Only refactoring and documentation
1924 changes require no new tests. If you are adding functionality
2025 or fixing a bug, please add a test.
2126
22271 . Squash your commits down into logical components. Make sure to rebase
23- against the current master.
28+ against our current master.
2429
25301 . Push the branch to your fork and submit a pull request.
2631
@@ -38,7 +43,9 @@ By default the tests use a baseline version of Puppet.
3843If you have Ruby 2.x or want a specific version of Puppet,
3944you must set an environment variable such as:
4045
41- export PUPPET_VERSION="~> 4.2.0"
46+ ``` sh
47+ export PUPPET_VERSION=" ~> 5.5.6"
48+ ```
4249
4350You can install all needed gems for spec tests into the modules directory by
4451running:
@@ -65,13 +72,17 @@ The test suite will run [Puppet Lint](http://puppet-lint.com/) and
6572[ Puppet Syntax] ( https://github.com/gds-operations/puppet-syntax ) to
6673check various syntax and style things. You can run these locally with:
6774
68- bundle exec rake lint
69- bundle exec rake validate
75+ ``` sh
76+ bundle exec rake lint
77+ bundle exec rake validate
78+ ```
7079
7180It will also run some [ Rubocop] ( http://batsov.com/rubocop/ ) tests
7281against it. You can run those locally ahead of time with:
7382
74- bundle exec rake rubocop
83+ ``` sh
84+ bundle exec rake rubocop
85+ ```
7586
7687## Running the unit tests
7788
@@ -82,15 +93,21 @@ about how best to test your new feature.
8293
8394To run the linter, the syntax checker and the unit tests:
8495
85- bundle exec rake test
96+ ``` sh
97+ bundle exec rake test
98+ ```
8699
87100To run your all the unit tests
88101
89- bundle exec rake spec SPEC_OPTS='--format documentation'
102+ ``` sh
103+ bundle exec rake spec
104+ ```
90105
91106To run a specific spec test set the ` SPEC ` variable:
92107
93- bundle exec rake spec SPEC=spec/foo_spec.rb
108+ ``` sh
109+ bundle exec rake spec SPEC=spec/foo_spec.rb
110+ ```
94111
95112## Integration tests
96113
@@ -102,23 +119,51 @@ This fires up a new virtual machine (using vagrant) and runs a series of
102119simple tests against it after applying the module. You can run this
103120with:
104121
105- bundle exec rake acceptance
122+ ``` sh
123+ bundle exec rake acceptance
124+ ```
106125
107126This will run the tests on the module's default nodeset. You can override the
108127nodeset used, e.g.,
109128
110- BEAKER_set=centos-7-x64 bundle exec rake acceptance
129+ ``` sh
130+ BEAKER_set=centos-7-x64 bundle exec rake acceptance
131+ ```
111132
112133There are default rake tasks for the various acceptance test modules, e.g.,
113134
114- bundle exec rake beaker:centos-7-x64
115- bundle exec rake beaker:ssh:centos-7-x64
135+ ``` sh
136+ bundle exec rake beaker:centos-7-x64
137+ bundle exec rake beaker:ssh:centos-7-x64
138+ ```
116139
117140If you don't want to have to recreate the virtual machine every time you can
118141use ` BEAKER_destroy=no ` and ` BEAKER_provision=no ` . On the first run you will at
119142least need ` BEAKER_provision ` set to yes (the default). The Vagrantfile for the
120143created virtual machines will be in ` .vagrant/beaker_vagrant_files ` .
121144
145+ Beaker also supports docker containers. We also use that in our automated CI
146+ pipeline at [ travis-ci] ( http://travis-ci.org ) . To use that instead of Vagrant:
147+
148+ ```
149+ 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
150+ ```
151+
152+ You can replace the string ` debian9 ` with any common operating system.
153+ The following strings are known to work:
154+
155+ * ubuntu1604
156+ * ubuntu1804
157+ * debian8
158+ * debian9
159+ * centos6
160+ * centos7
161+
122162The easiest way to debug in a docker container is to open a shell:
123163
124- docker exec -it -u root ${container_id_or_name} bash
164+ ``` sh
165+ docker exec -it -u root ${container_id_or_name} bash
166+ ```
167+
168+ The source of this file is in our [ modulesync_config] ( https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb )
169+ repository.
0 commit comments