@@ -12,15 +12,20 @@ By participating in this project you agree to abide by its terms.
12
12
13
13
1 . Create a separate branch for your change.
14
14
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.
17
22
18
23
1 . Add a test for your change. Only refactoring and documentation
19
24
changes require no new tests. If you are adding functionality
20
25
or fixing a bug, please add a test.
21
26
22
27
1 . Squash your commits down into logical components. Make sure to rebase
23
- against the current master.
28
+ against our current master.
24
29
25
30
1 . Push the branch to your fork and submit a pull request.
26
31
@@ -38,7 +43,9 @@ By default the tests use a baseline version of Puppet.
38
43
If you have Ruby 2.x or want a specific version of Puppet,
39
44
you must set an environment variable such as:
40
45
41
- export PUPPET_VERSION="~> 4.2.0"
46
+ ``` sh
47
+ export PUPPET_VERSION=" ~> 5.5.6"
48
+ ```
42
49
43
50
You can install all needed gems for spec tests into the modules directory by
44
51
running:
@@ -65,13 +72,17 @@ The test suite will run [Puppet Lint](http://puppet-lint.com/) and
65
72
[ Puppet Syntax] ( https://github.com/gds-operations/puppet-syntax ) to
66
73
check various syntax and style things. You can run these locally with:
67
74
68
- bundle exec rake lint
69
- bundle exec rake validate
75
+ ``` sh
76
+ bundle exec rake lint
77
+ bundle exec rake validate
78
+ ```
70
79
71
80
It will also run some [ Rubocop] ( http://batsov.com/rubocop/ ) tests
72
81
against it. You can run those locally ahead of time with:
73
82
74
- bundle exec rake rubocop
83
+ ``` sh
84
+ bundle exec rake rubocop
85
+ ```
75
86
76
87
## Running the unit tests
77
88
@@ -82,15 +93,21 @@ about how best to test your new feature.
82
93
83
94
To run the linter, the syntax checker and the unit tests:
84
95
85
- bundle exec rake test
96
+ ``` sh
97
+ bundle exec rake test
98
+ ```
86
99
87
100
To run your all the unit tests
88
101
89
- bundle exec rake spec SPEC_OPTS='--format documentation'
102
+ ``` sh
103
+ bundle exec rake spec
104
+ ```
90
105
91
106
To run a specific spec test set the ` SPEC ` variable:
92
107
93
- bundle exec rake spec SPEC=spec/foo_spec.rb
108
+ ``` sh
109
+ bundle exec rake spec SPEC=spec/foo_spec.rb
110
+ ```
94
111
95
112
## Integration tests
96
113
@@ -102,23 +119,51 @@ This fires up a new virtual machine (using vagrant) and runs a series of
102
119
simple tests against it after applying the module. You can run this
103
120
with:
104
121
105
- bundle exec rake acceptance
122
+ ``` sh
123
+ bundle exec rake acceptance
124
+ ```
106
125
107
126
This will run the tests on the module's default nodeset. You can override the
108
127
nodeset used, e.g.,
109
128
110
- BEAKER_set=centos-7-x64 bundle exec rake acceptance
129
+ ``` sh
130
+ BEAKER_set=centos-7-x64 bundle exec rake acceptance
131
+ ```
111
132
112
133
There are default rake tasks for the various acceptance test modules, e.g.,
113
134
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
+ ```
116
139
117
140
If you don't want to have to recreate the virtual machine every time you can
118
141
use ` BEAKER_destroy=no ` and ` BEAKER_provision=no ` . On the first run you will at
119
142
least need ` BEAKER_provision ` set to yes (the default). The Vagrantfile for the
120
143
created virtual machines will be in ` .vagrant/beaker_vagrant_files ` .
121
144
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
+
122
162
The easiest way to debug in a docker container is to open a shell:
123
163
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