Skip to content

Commit 30c1995

Browse files
authored
Merge pull request #124 from voxpupuli/modulesync
modulesync 2.2.0 and allow puppet 6.x
2 parents abf7d5e + 021cdec commit 30c1995

9 files changed

+95
-41
lines changed

.fixtures.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@ fixtures:
22
repositories:
33
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git'
44
concat: 'https://github.com/puppetlabs/puppetlabs-concat.git'
5-
symlinks:
6-
yum: "#{source_dir}"
5+
augeas_core:
6+
repo: https://github.com/puppetlabs/puppetlabs-augeas_core.git
7+
puppet_version: ">= 6.0.0"
8+
yumrepo_core:
9+
repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git
10+
puppet_version: ">= 6.0.0"

.github/CONTRIBUTING.md

+60-15
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,20 @@ By participating in this project you agree to abide by its terms.
1212

1313
1. 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

1823
1. 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

2227
1. Squash your commits down into logical components. Make sure to rebase
23-
against the current master.
28+
against our current master.
2429

2530
1. 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.
3843
If you have Ruby 2.x or want a specific version of Puppet,
3944
you 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

4350
You can install all needed gems for spec tests into the modules directory by
4451
running:
@@ -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
6673
check 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

7180
It will also run some [Rubocop](http://batsov.com/rubocop/) tests
7281
against 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

8394
To 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

87100
To 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

91106
To 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
102119
simple tests against it after applying the module. You can run this
103120
with:
104121

105-
bundle exec rake acceptance
122+
```sh
123+
bundle exec rake acceptance
124+
```
106125

107126
This will run the tests on the module's default nodeset. You can override the
108127
nodeset 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

112133
There 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

117140
If you don't want to have to recreate the virtual machine every time you can
118141
use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will at
119142
least need `BEAKER_provision` set to yes (the default). The Vagrantfile for the
120143
created 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+
122162
The 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.

.msync.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
modulesync_config_version: '2.0.0'
1+
modulesync_config_version: '2.2.0'

.travis.yml

+16-4
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ matrix:
1818
env: PUPPET_VERSION="~> 5.0" CHECK=test
1919
- rvm: 2.5.1
2020
bundler_args: --without system_tests development release
21-
env: PUPPET_VERSION="~> 5.0" CHECK=test_with_coveralls
22-
- rvm: 2.4.4
23-
bundler_args: --without system_tests development release
24-
env: PUPPET_VERSION="~> 5.0" CHECK=rubocop
21+
env: PUPPET_VERSION="~> 6.0" CHECK=test_with_coveralls
2522
- rvm: 2.5.1
23+
bundler_args: --without system_tests development release
24+
env: PUPPET_VERSION="~> 6.0" CHECK=rubocop
25+
- rvm: 2.4.4
2626
bundler_args: --without system_tests development release
2727
env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes
2828
- rvm: 2.5.1
@@ -31,6 +31,12 @@ matrix:
3131
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos6-64{hypervisor=docker} CHECK=beaker
3232
services: docker
3333
sudo: required
34+
- rvm: 2.5.1
35+
bundler_args: --without development release
36+
dist: trusty
37+
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos6-64{hypervisor=docker} CHECK=beaker
38+
services: docker
39+
sudo: required
3440
- rvm: 2.5.1
3541
bundler_args: --without development release
3642
dist: trusty
@@ -43,6 +49,12 @@ matrix:
4349
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker
4450
services: docker
4551
sudo: required
52+
- rvm: 2.5.1
53+
bundler_args: --without development release
54+
dist: trusty
55+
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker
56+
services: docker
57+
sudo: required
4658
- rvm: 2.5.1
4759
bundler_args: --without development release
4860
dist: trusty

Gemfile

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ def location_for(place, fake_version = nil)
1111
end
1212

1313
group :test do
14-
gem 'puppetlabs_spec_helper', '~> 2.6', :require => false
15-
gem 'rspec-puppet', '~> 2.5', :require => false
16-
gem 'rspec-puppet-facts', :require => false
14+
gem 'puppetlabs_spec_helper', '>= 2.11.0', :require => false
15+
gem 'rspec-puppet-facts', '>= 1.8.0', :require => false
1716
gem 'rspec-puppet-utils', :require => false
1817
gem 'puppet-lint-leading_zero-check', :require => false
1918
gem 'puppet-lint-trailing_comma-check', :require => false

metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"requirements": [
6363
{
6464
"name": "puppet",
65-
"version_requirement": ">= 4.10.0 < 6.0.0"
65+
"version_requirement": ">= 4.10.0 < 7.0.0"
6666
}
6767
]
6868
}

spec/classes/coverage_spec.rb

-4
This file was deleted.

spec/default_facts.yml

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
# Hint if using with rspec-puppet-facts ("on_supported_os.each"):
99
# if a same named fact exists in facterdb it will be overridden.
1010
---
11-
concat_basedir: "/tmp"
1211
ipaddress: "172.16.254.254"
1312
is_pe: false
1413
macaddress: "AA:AA:AA:AA:AA:AA"

spec/spec_helper.rb

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
require 'puppetlabs_spec_helper/module_spec_helper'
2-
require 'rspec-puppet-facts'
3-
include RspecPuppetFacts
4-
51
# This file is managed via modulesync
62
# https://github.com/voxpupuli/modulesync
73
# https://github.com/voxpupuli/modulesync_config
4+
require 'puppetlabs_spec_helper/module_spec_helper'
5+
require 'rspec-puppet-facts'
6+
include RspecPuppetFacts
87

98
if Dir.exist?(File.expand_path('../../lib', __FILE__))
109
require 'coveralls'
@@ -23,14 +22,14 @@
2322
end
2423

2524
RSpec.configure do |c|
26-
default_facts = {
27-
puppetversion: Puppet.version,
28-
facterversion: Facter.version
29-
}
25+
default_facts = {}
3026
default_facts.merge!(YAML.load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__))
3127
default_facts.merge!(YAML.load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__))
3228
c.default_facts = default_facts
3329
c.hiera_config = File.expand_path(File.join(__FILE__, '../fixtures/hiera.yaml'))
34-
end
3530

36-
# vim: syntax=ruby
31+
# Coverage generation
32+
c.after(:suite) do
33+
RSpec::Puppet::Coverage.report!
34+
end
35+
end

0 commit comments

Comments
 (0)