rspec-puppet-facts 1.9.6 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a64115f0d16cfdcdc93bae297977afe14d8cc710
4
- data.tar.gz: ae69075f4678a762b2f9974144ba275f095aac9f
2
+ SHA256:
3
+ metadata.gz: 5abb33ab4c828904545dfb7880ea691eee1703dc1cc752d813bf5a75ad253719
4
+ data.tar.gz: 5bc5af1d2e497f8ce4ccb89fb8b44ce95d8e899fa3c2e6f990fb5295ca36cabd
5
5
  SHA512:
6
- metadata.gz: 98b7d46da60565cec886e89b78bf15dee26691d9f7060d6ad48852f19ea0fa0799a50412e16e4ee089689aa71dd7e831eff420f8e3ebd811fbe13ecca3631402
7
- data.tar.gz: 812d53e7265c0f97af809625ca4d8f2b2a0c963d70e2aad0ae35aa6c8f2ac882138e7d6257f03b8251baf5bde0e04795af396da0bdad234359f7e8e7b05f43d6
6
+ metadata.gz: 76ea0db9e3c0093daa7f642395c87e0d641b536b61075887a4880a3b2f7d60eacda4b3f2b9afeaec1c20a531ff4896e169521f55c3c0a9cd4eda43013ca465d3
7
+ data.tar.gz: 33008991d7da69ce99987f66214d65631328816e63e40b3edf1fddf616f31f0a0e69a4a66e5eeacdc52b7bc7fd7dd535f4a5e55dba8d9d91e17cb073ed8e9662
@@ -0,0 +1,8 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ time: "04:00"
8
+ open-pull-requests-limit: 10
@@ -0,0 +1,32 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '*'
7
+
8
+ jobs:
9
+ release:
10
+ runs-on: ubuntu-latest
11
+ if: github.repository_owner == 'voxpupuli'
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Install Ruby 3.0
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: '3.0'
18
+ env:
19
+ BUNDLE_WITHOUT: release
20
+ - name: Build gem
21
+ run: gem build *.gemspec
22
+ - name: Publish gem to rubygems.org
23
+ run: gem push *.gem
24
+ env:
25
+ GEM_HOST_API_KEY: '${{ secrets.RUBYGEMS_AUTH_TOKEN }}'
26
+ - name: Setup GitHub packages access
27
+ run: |
28
+ mkdir -p ~/.gem
29
+ echo ":github: Bearer ${{ secrets.GITHUB_TOKEN }}" >> ~/.gem/credentials
30
+ chmod 0600 ~/.gem/credentials
31
+ - name: Publish gem to GitHub packages
32
+ run: gem push --key github --host https://rubygems.pkg.github.com/voxpupuli *.gem
@@ -0,0 +1,37 @@
1
+ name: Test
2
+
3
+ on:
4
+ - pull_request
5
+ - push
6
+
7
+ env:
8
+ BUNDLE_WITHOUT: release
9
+
10
+ jobs:
11
+ test:
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ include:
17
+ - ruby: '2.4'
18
+ - ruby: '2.5'
19
+ - ruby: '2.6'
20
+ - ruby: '2.7'
21
+ - ruby: '3.0'
22
+ coverage: 'yes'
23
+ env:
24
+ COVERAGE: ${{ matrix.coverage }}
25
+ steps:
26
+ - uses: actions/checkout@v2
27
+ - name: Install Ruby ${{ matrix.ruby }}
28
+ uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: ${{ matrix.ruby }}
31
+ bundler-cache: true
32
+ - name: Run unit tests
33
+ run: bundle exec rake spec
34
+ - name: Test against Puppet component versions
35
+ run: bundle exec rake puppet_versions:test
36
+ - name: Test gem build
37
+ run: bundle exec rake build
data/.gitignore CHANGED
@@ -8,3 +8,4 @@ coverage/
8
8
  doc
9
9
  .yardoc
10
10
  vendor/
11
+ .vendor/
data/CHANGELOG.md CHANGED
@@ -1,3 +1,48 @@
1
+ # Changelog
2
+
3
+ ## [2.0.2](https://github.com/voxpupuli/rspec-puppet-facts/tree/2.0.2) (2021-07-21)
4
+
5
+ [Full Changelog](https://github.com/voxpupuli/rspec-puppet-facts/compare/2.0.1...2.0.2)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Implement github action testing and codecov coverage reporting [\#129](https://github.com/voxpupuli/rspec-puppet-facts/pull/129) ([bastelfreak](https://github.com/bastelfreak))
10
+
11
+ **Merged pull requests:**
12
+
13
+ - Move facterversion\_obj declaration out of the loop [\#131](https://github.com/voxpupuli/rspec-puppet-facts/pull/131) ([ekohl](https://github.com/ekohl))
14
+ - Upgrade to GitHub-native Dependabot [\#126](https://github.com/voxpupuli/rspec-puppet-facts/pull/126) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
15
+
16
+ ## [2.0.1](https://github.com/voxpupuli/rspec-puppet-facts/tree/2.0.1) (2021-01-09)
17
+
18
+ [Full Changelog](https://github.com/voxpupuli/rspec-puppet-facts/compare/2.0.0...2.0.1)
19
+
20
+ **Closed issues:**
21
+
22
+ - Memoizing facts [\#114](https://github.com/voxpupuli/rspec-puppet-facts/issues/114)
23
+ - Commit 21442e7 looks to introduce hard to debug behavior [\#97](https://github.com/voxpupuli/rspec-puppet-facts/issues/97)
24
+
25
+ **Merged pull requests:**
26
+
27
+ - Implement fact memoization [\#122](https://github.com/voxpupuli/rspec-puppet-facts/pull/122) ([ekohl](https://github.com/ekohl))
28
+
29
+ ## [2.0.0](https://github.com/voxpupuli/rspec-puppet-facts/tree/2.0.0) (2020-08-05)
30
+
31
+ - Require Ruby >= 2.4
32
+ - Automatically find the latest facter version in the database. Previously a
33
+ very slow and undeterministic approach was taken when an exact match of the
34
+ Facter version wasn't found.. The new approach is to take the closest version
35
+ that is still older than the specified version.
36
+ - Fix Amazon Linux 2 fact lookup
37
+ - Log which facts could not be found
38
+ - Remove json as a dependency
39
+
40
+ ## 2019-12-11 - Release 1.10.0
41
+ - Automatically select the default Facter version based on the Puppet version.
42
+ The available Puppet version is matched against a mapping of Puppet and
43
+ Facter versions included in the `puppet-agent` all-in-one packages to find
44
+ the most suitable Facter version.
45
+
1
46
  ## 2019-07-31 - Release 1.9.6
2
47
  - Suppress the warning message generated when the Augeas gem is not available.
3
48
  - Searching through older Facter releases for a fact set that does not exist no
@@ -190,3 +235,6 @@
190
235
 
191
236
  ## 2014-12-12 - First Release 0.1.0
192
237
  - Initial release
238
+
239
+
240
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source ENV['GEM_SOURCE'] || "https://rubygems.org"
1
+ source ENV['GEM_SOURCE'] || 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
@@ -7,3 +7,12 @@ if facterversion = ENV['FACTER_GEM_VERSION']
7
7
  else
8
8
  gem 'facter', :require => false
9
9
  end
10
+
11
+ group :release do
12
+ gem 'github_changelog_generator', require: false
13
+ end
14
+
15
+ group :coverage, optional: ENV['COVERAGE']!='yes' do
16
+ gem 'simplecov-console', :require => false
17
+ gem 'codecov', :require => false
18
+ end
data/HISTORY.md ADDED
@@ -0,0 +1,209 @@
1
+ ## [2.0.0](https://github.com/voxpupuli/rspec-puppet-facts/tree/2.0.0) (2020-08-05)
2
+
3
+ - Require Ruby >= 2.4
4
+ - Automatically find the latest facter version in the database. Previously a
5
+ very slow and undeterministic approach was taken when an exact match of the
6
+ Facter version wasn't found.. The new approach is to take the closest version
7
+ that is still older than the specified version.
8
+ - Fix Amazon Linux 2 fact lookup
9
+ - Log which facts could not be found
10
+ - Remove json as a dependency
11
+
12
+ ## 2019-12-11 - Release 1.10.0
13
+ - Automatically select the default Facter version based on the Puppet version.
14
+ The available Puppet version is matched against a mapping of Puppet and
15
+ Facter versions included in the `puppet-agent` all-in-one packages to find
16
+ the most suitable Facter version.
17
+
18
+ ## 2019-07-31 - Release 1.9.6
19
+ - Suppress the warning message generated when the Augeas gem is not available.
20
+ - Searching through older Facter releases for a fact set that does not exist no
21
+ longer causes it to hang indefinitely.
22
+ - The `operatingsystemrelease` values are now correctly escaped when building
23
+ the FacterDB filters, allowing the use of `operatingsystemrelease` values
24
+ that contain special regular expression characters like parentheses.
25
+
26
+ ## 2019-07-29 - Release 1.9.5
27
+ - The default version of Facter to search for is now configurable with
28
+ `RSpec.configuration.default_facter_version`.
29
+ - When passing a `:supported_os` hash to `on_supported_os()`, single
30
+ `operatingsystemrelease` values can now be specified as a String rather than
31
+ an Array with a single String.
32
+ - Dependency on the `mcollective-client` gem removed. The `mco_version` fact
33
+ will now optionally be set if the gem is installed.
34
+ - The fact names can now be provided to tests as Strings instead of Symbols by
35
+ setting `RSpec.configuration.facterdb_string_keys` to `true`.
36
+ - Dropped support for Ruby < 2.1.0
37
+
38
+ ## 2019-03-22 - Release 1.9.4
39
+ - Take two on getting rubygems autodeploy going. So much for docs,
40
+ looking at other projects for this one.
41
+ ## 2019-03-22 - Release 1.9.3
42
+ - Various CI updates - [Garrett Honeycutt](https://github.com/ghoneycutt/)
43
+ - Symbolize hash keys in `register_custom_fact`
44
+ [https://github.com/mcanevet/rspec-puppet-facts/pull/77](https://github.com/mcanevet/rspec-puppet-facts/pull/77)
45
+
46
+ ## 2018-10-24 - Release 1.9.2
47
+ - Catch the right `LoadError` on missing augeas gem. Thanks to [baurmatt](https://github.com/baurmatt) for the quick fix, and [rodjek](https://github.com/rodjek) for dealing with the testing
48
+
49
+ ## 2018-10-24 - Release 1.9.1
50
+ - Do not rely on features of Augeas because Puppet 6
51
+
52
+ ## 2018-01-31 - Release 1.9.0
53
+ - Bumps facterdb requirement to 0.5.0
54
+ - Adds docs for using custom external facts
55
+ - hardwaremodel output changed on Windows with Facter 3.x
56
+ - Add additional rqspec tests
57
+ - Correctly select windows releases that contain spaces
58
+ - Facter < 3.4 does not return a proper release name for Windows 2016
59
+ - Strip 'Server' prefix from windows release name if present
60
+ - Downcase windows to match facter output
61
+ - Fix specs for current facterdb release
62
+ - Make version fallback testing independent of installed facter gem
63
+ - Add SPEC_FACTS_STRICT setting
64
+ - Cleanup README
65
+ - Add specific test to test minor version ahead of current facter version
66
+ - Update test to check for range in case facter version is not currently in FacterDB
67
+ - Step down through versions if the current version is not available
68
+ - Fix wrong example in README
69
+
70
+ ## 2017-06-23 - Release 1.8.0
71
+ - Support specifying facter version
72
+
73
+ ## 2017-01-04 - Release 1.7.1
74
+ - Ignore case when choosing H/W models
75
+
76
+ ## 2016-09-16 - Release 1.7.0
77
+ - Support custom facts defined by spec_helper
78
+
79
+ ## 2016-05-19 - Release 1.6.1
80
+ - Fix a bug where not all specified Ubuntu or OpenBSD were captured
81
+
82
+ ## 2016-05-17 - Release 1.6.0
83
+ - Cleanup and refactor methods
84
+ - Add YARD documentation
85
+ - Refactor and fix rspec
86
+ - Add the OS filter support
87
+
88
+ ## 2016-03-29 - Release 1.5.0
89
+ - Add some Microsft Windows support
90
+
91
+ ## 2016-02-04 - Release 1.4.1
92
+ - Add missing mcollective-client dependency
93
+
94
+ ## 2016-02-04 - Release 1.4.0
95
+ - Dynamically set mco_version
96
+
97
+ ## 2015-11-12 - Release 1.3.0
98
+ - Dynamically set rubysitedir
99
+
100
+ ## 2015-11-05 - Release 1.2.0
101
+ - Requires facterdb 0.3.0
102
+
103
+ ## 2015-09-15 - Release 1.1.1
104
+ - Fix OpenBSD support
105
+
106
+ ## 2015-09-09 - Release 1.1.0
107
+ - Populate augeasversion, puppetversion and rubyversion
108
+
109
+ ## 2015-09-03 - Release 1.0.3
110
+ - Fix FreeBSD support
111
+
112
+ ## 2015-08-31 - Release 1.0.2
113
+ - Keys where not symbolized anymore since v1.0.0
114
+
115
+ ## 2015-08-29 - Release 1.0.1
116
+ - Fix for old versions of Facter that does not provide operatingsystemmajrelease for some OSes
117
+
118
+ ## 2015-08-27 - Release 1.0.0
119
+ - Use facterdb
120
+
121
+ ## 2015-08-10 - Release 0.12.0
122
+ - Add Facter3 support
123
+
124
+ ## 2015-06-16 - Release 0.11.0
125
+ - Add facts for OpenBSD 5.7
126
+
127
+ ## 2015-05-27 - Release 0.10.0
128
+ - Add facts for Solaris 11
129
+
130
+ ## 2015-05-26 - Release 0.9.0
131
+ - Add facts for Ubuntu 14.10
132
+ - Add facts for Ubuntu 15.04
133
+
134
+ ## 2015-04-27 - Release 0.8.0
135
+ - Remove support for Operating System minor release (causes problems with Ubuntu naming)
136
+ - Add Gentoo support
137
+
138
+ ## 2015-04-26 - Release 0.7.0
139
+ - Add support for Operating System minor release
140
+ - Update README.md
141
+
142
+ ## 2015-03-06 - Release 0.6.0
143
+ - Add facts for FreeBSD 9
144
+
145
+ ## 2015-03-06 - Release 0.5.0
146
+ - Add facts for FreeBSD 10
147
+
148
+ ## 2015-02-22 - Release 0.4.1
149
+ - Really useless release :-)
150
+
151
+ ## 2015-01-23 - Release 0.4.0
152
+ - Add facts for facter 2.4
153
+ - Format json with python's json.tool
154
+ - Improve code coverage in unit tests
155
+ - Test on more version of facter in travis matrix
156
+
157
+ ## 2015-01-05 - Release 0.3.3
158
+ - Add facts for OpenSuse 12
159
+ - Add facts for OpenSuse 13
160
+
161
+ ## 2015-01-04 - Release 0.3.2
162
+ * Symbolize hash keys
163
+
164
+ ## 2015-01-03 - Release 0.3.1
165
+ - Set fqdn to foo.example.com
166
+ - Add json as runtime dependency
167
+
168
+ ## 2015-01-02 - Release 0.3.0
169
+ - Use json output for facter
170
+
171
+ ## 2014-12-20 - Release 0.2.5
172
+ - Don't fail if facts not found
173
+
174
+ ## 2014-12-20 - Release 0.2.4
175
+ - Add facts for SLES 11
176
+ - Add facts for Ubuntu 10.04
177
+ - Fix for SLES 11 SP1
178
+
179
+ ## 2014-12-20 - Release 0.2.3
180
+ - Add facts for ArchLinux
181
+
182
+ ## 2014-12-19 - Release 0.2.2
183
+ - Fix some bugs
184
+ - Add unit tests
185
+
186
+ ## 2014-12-19 - Release 0.2.1
187
+ - Add facts for Debian 8
188
+
189
+ ## 2014-12-15 - Release 0.2.0
190
+ - Add opts hash parameter
191
+ - Tests only with x86_64 by default
192
+
193
+ ## 2014-12-12 - Release 0.1.4
194
+ - Fix for Ubuntu
195
+
196
+ ## 2014-12-12 - Release 0.1.4
197
+ - Fix for Fedora
198
+
199
+ ## 2014-12-12 - Release 0.1.3
200
+ - Add facts for Fedora 19
201
+
202
+ ## 2014-12-12 - Release 0.1.2
203
+ - Add facts for Scientific Linux
204
+
205
+ ## 2014-12-12 - Release 0.1.1
206
+ - Add more facts
207
+
208
+ ## 2014-12-12 - First Release 0.1.0
209
+ - Initial release
data/README.md CHANGED
@@ -1,13 +1,19 @@
1
1
  rspec-puppet-facts
2
2
  ==================
3
3
 
4
- [![Build Status](https://img.shields.io/travis/mcanevet/rspec-puppet-facts/master.svg)](https://travis-ci.org/mcanevet/rspec-puppet-facts)
5
- [![Code Climate](https://img.shields.io/codeclimate/github/mcanevet/rspec-puppet-facts.svg)](https://codeclimate.com/github/mcanevet/rspec-puppet-facts)
6
- [![Gem Version](https://img.shields.io/gem/v/rspec-puppet-facts.svg)](https://rubygems.org/gems/rspec-puppet-facts)
7
- [![Gem Downloads](https://img.shields.io/gem/dt/rspec-puppet-facts.svg)](https://rubygems.org/gems/rspec-puppet-facts)
8
- [![Coverage Status](https://img.shields.io/coveralls/mcanevet/rspec-puppet-facts.svg)](https://coveralls.io/r/mcanevet/rspec-puppet-facts?branch=master)
9
-
10
- Based on an original idea from [apenney](https://github.com/apenney/puppet_facts/), this gem provides a method of running your [rspec-puppet](https://github.com/rodjek/rspec-puppet) tests against the facts for all your supported operating systems (provided by [facterdb](https://github.com/camptocamp/facterdb). This simplifies unit testing because you don't need to specify the facts yourself.
4
+ [![License](https://img.shields.io/github/license/voxpupuli/rspec-puppet-facts.svg)](https://github.com/voxpupuli/rspec-puppet-facts/blob/master/LICENSE)
5
+ [![Test](https://github.com/voxpupuli/rspec-puppet-facts/actions/workflows/test.yml/badge.svg)](https://github.com/voxpupuli/rspec-puppet-facts/actions/workflows/test.yml)
6
+ [![codecov](https://codecov.io/gh/voxpupuli/rspec-puppet-facts/branch/master/graph/badge.svg)](https://codecov.io/gh/voxpupuli/rspec-puppet-facts)
7
+ [![Release](https://github.com/voxpupuli/rspec-puppet-facts/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/rspec-puppet-facts/actions/workflows/release.yml)
8
+ [![RubyGem Version](https://img.shields.io/gem/v/rspec-puppet-facts.svg)](https://rubygems.org/gems/rspec-puppet-facts)
9
+ [![RubyGem Downloads](https://img.shields.io/gem/dt/rspec-puppet-facts.svg)](https://rubygems.org/gems/rspec-puppet-facts)
10
+ [![Donated by Camptocamp](https://img.shields.io/badge/donated%20by-camptocamp-fb7047.svg)](#transfer-notice)
11
+
12
+ Based on an original idea from [apenney](https://github.com/apenney/puppet_facts/),
13
+ this gem provides a method of running your [rspec-puppet](https://github.com/rodjek/rspec-puppet)
14
+ tests against the facts for all your supported operating systems (provided by
15
+ [facterdb](https://github.com/voxpupuli/facterdb)).
16
+ This simplifies unit testing because you don't need to specify the facts yourself.
11
17
 
12
18
  ## Installation
13
19
 
@@ -64,8 +70,27 @@ describe 'myclass::debian' do
64
70
  ],
65
71
  }
66
72
 
67
- on_supported_os(test_on).each do |os, facts|
68
- let (:facts) { facts }
73
+ on_supported_os(test_on).each do |os, os_facts|
74
+ let (:facts) { os_facts }
75
+ it { is_expected.to compile.with_all_deps }
76
+ end
77
+ end
78
+ ```
79
+ Ruby 1.9 and later:
80
+ ```ruby
81
+ require 'spec_helper'
82
+
83
+ describe 'myclass::raspbian' do
84
+ test_on = {
85
+ supported_os: [
86
+ {
87
+ 'operatingsystem' => 'Debian',
88
+ 'operatingsystemrelease' => ['10', '9', '8'],
89
+ },
90
+ ],
91
+ }
92
+ on_supported_os(test_on).each do |os, os_facts|
93
+ let(:facts) { os_facts }
69
94
  it { is_expected.to compile.with_all_deps }
70
95
  end
71
96
  end
@@ -139,17 +164,17 @@ require 'spec_helper'
139
164
 
140
165
  describe 'myclass' do
141
166
 
142
- on_supported_os.each do |os, facts|
167
+ on_supported_os.each do |os, os_facts|
143
168
  context "on #{os}" do
144
169
  let(:facts) do
145
- facts
170
+ os_facts
146
171
  end
147
172
 
148
173
  it { is_expected.to compile.with_all_deps }
149
174
  ...
150
175
 
151
176
  # If you need any to specify any operating system specific tests
152
- case facts[:osfamily]
177
+ case os_facts[:osfamily]
153
178
  when 'Debian'
154
179
  ...
155
180
  else
@@ -160,6 +185,56 @@ describe 'myclass' do
160
185
  end
161
186
  ```
162
187
 
188
+ When using roles and profiles to manage a heterogeneous IT estate, you can test a profile that supports several OSes with many `let(:facts)` as long as each is in its own context:
189
+ ```ruby
190
+ require 'spec_helper'
191
+
192
+ describe 'profiles::packagerepos' do
193
+ context 'Raspbian tests' do # We manage hundreds of desk-mounted Pis
194
+ raspbian = {
195
+ hardwaremodels: ['armv7l'],
196
+ supported_os: [
197
+ {
198
+ 'operatingsystem' => 'Debian',
199
+ 'operatingsystemrelease' => ['10', '9', '8'],
200
+ },
201
+ ],
202
+ }
203
+ on_supported_os(raspbian).each do |os, os_facts|
204
+ let(:facts) do
205
+ os_facts
206
+ end
207
+
208
+ context "#{os} with defaults" do
209
+ it { is_expected.to compile }
210
+ # more tests ...
211
+ end
212
+ end
213
+ end
214
+ context 'Ubuntu tests' do # And also a fleet of Ubuntu desktops
215
+ ubuntu = {
216
+ supported_os: [
217
+ {
218
+ 'operatingsystem' => 'Ubuntu',
219
+ 'operatingsystemrelease' => ['18.04', '16.04'],
220
+ },
221
+ ],
222
+ }
223
+
224
+ on_supported_os(ubuntu).each do |os, os_facts|
225
+ let(:facts) do
226
+ os_facts
227
+ end
228
+
229
+ context "#{os} with defaults" do
230
+ it { is_expected.to compile }
231
+ # more tests ...
232
+ end
233
+ end
234
+ end
235
+ end
236
+ ```
237
+
163
238
  ### Testing a type or provider
164
239
 
165
240
  Use `on_supported_os` in the same way for your type and provider unit tests.
@@ -207,17 +282,17 @@ require 'spec_helper'
207
282
 
208
283
  describe 'mytype' do
209
284
 
210
- on_supported_os.each do |os, facts|
285
+ on_supported_os.each do |os, os_facts|
211
286
  context "on #{os}" do
212
287
  let(:facts) do
213
- facts
288
+ os_facts
214
289
  end
215
290
 
216
291
  it { should be_valid_type }
217
292
  ...
218
293
 
219
294
  # If you need to specify any operating system specific tests
220
- case facts[:osfamily]
295
+ case os_facts[:osfamily]
221
296
  when 'Debian'
222
297
  ...
223
298
  else
@@ -275,10 +350,10 @@ require 'spec_helper'
275
350
 
276
351
  describe 'myfunction' do
277
352
 
278
- on_supported_os.each do |os, facts|
353
+ on_supported_os.each do |os, os_facts|
279
354
  context "on #{os}" do
280
355
  let(:facts) do
281
- facts
356
+ os_facts
282
357
  end
283
358
 
284
359
  it { should run.with_params('something').and_return('a value') }
@@ -307,12 +382,12 @@ To override fact values and include additional facts in your tests, merge values
307
382
  require 'spec_helper'
308
383
 
309
384
  describe 'myclass' do
310
- on_supported_os.each do |os, facts|
385
+ on_supported_os.each do |os, os_facts|
311
386
  context "on #{os}" do
312
387
 
313
388
  # Add the 'foo' fact with the value 'bar' to the tests
314
389
  let(:facts) do
315
- facts.merge({
390
+ os_facts.merge({
316
391
  :foo => 'bar',
317
392
  })
318
393
  end
@@ -368,9 +443,9 @@ To do this, pass a lambda as the value for the custom fact. The lambda is passed
368
443
  add_custom_fact :root_home, lambda { |os,facts| "/tmp/#{facts['hostname']}" }
369
444
  ```
370
445
 
371
- ### Suppling Custom External Facts through FacterDB
446
+ ### Supplying Custom External Facts through FacterDB
372
447
  Rspec-puppet-facts uses a gem called facterdb that contains many fact sets of various combinations that are pre generated. Rspec-puppet-facts queries
373
- facterdb to pull out a specific fact set to use when testing.
448
+ facterdb to pull out a specific fact set to use when testing.
374
449
 
375
450
  The default facts are great for many things but there will be times when you need to have custom
376
451
  fact sets that only make sense in your environment or might contain sensitive information.
@@ -379,7 +454,7 @@ To supply external facts to facterdb just set the `FACTERDB_SEARCH_PATHS` enviro
379
454
  paths to your facts.
380
455
 
381
456
  When separating paths please use the default path separator character supported by your OS.
382
- * Unix/Linux/OSX = `:`
457
+ * Unix/Linux/OSX = `:`
383
458
  * Windows = `;`
384
459
 
385
460
  This means you will need to supply your own fact sets in addition to the ones contained in facterdb.
@@ -435,7 +510,7 @@ ENV['FACTERDB_SEARCH_PATHS'] = custom_facts
435
510
  ```
436
511
  ## Running your tests
437
512
 
438
- For most cases, there is no change to how you run your tests. Running `rake spec` will run all the tests against the facts for all the supported operating systems.
513
+ For most cases, there is no change to how you run your tests. Running `rake spec` will run all the tests against the facts for all the supported operating systems. If you are developing a module using the [Puppet Development Kit](https://puppet.com/docs/pdk/1.x/pdk_install.html), `pdk test unit` will run all your tests against the supported operating systems listed in `metadata.json`.
439
514
 
440
515
  If you want to run the tests against the facts for specific operating systems, you can provide a filter in the `SPEC_FACTS_OS` environment variable and only the supported operating systems whose name starts with the specified filter will be used.
441
516
 
@@ -444,3 +519,31 @@ SPEC_FACTS_OS='ubuntu-14' rake spec
444
519
  ```
445
520
 
446
521
  When no facts are available for the specific facter/operating system combination, the library will fall back to facts from earlier versions of the requested operating system, to allow testing to continue when new versions of facter are released. Set `SPEC_FACTS_STRICT=yes` to instead trigger a failure.
522
+
523
+ ## Maintenance
524
+
525
+ This gem uses information about puppet AIO component versions to build/test.
526
+ They are vendored at `ext/puppet_agent_components.json`. If they are outdated,
527
+ the `puppet_versions:test` rake task will fail and they need to be updated.
528
+ This is as easy as running: `bundle exec rake puppet_versions:update`
529
+
530
+ ## License
531
+
532
+ This project is licensed under the [Apache-2 license](./LICENSE).
533
+
534
+ ## Transfer Notice
535
+
536
+ This plugin was originally authored by [Camptocamp](http://www.camptocamp.com).
537
+ The maintainer preferred that Puppet Community take ownership of the module for future improvement and maintenance.
538
+ Existing pull requests and issues were transferred over, please fork and continue to contribute here instead of Camptocamp.
539
+
540
+ Previously: https://github.com/mcanevet/rspec-puppet-facts
541
+
542
+ ## Release information
543
+
544
+ To make a new release, please do:
545
+ * Update the version in the `lib/rspec-puppet-facts/version.rb` file
546
+ * Install gems with `bundle install --with release --path .vendor`
547
+ * generate the changelog with `bundle exec rake changelog`
548
+ * Create a PR with it
549
+ * After it got merged, push a tag. A github workflow will do the actual release