voxpupuli-test 8.0.0 → 8.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -2
- data/lib/voxpupuli/test/facts.rb +7 -8
- data/lib/voxpupuli/test/rake.rb +14 -4
- data/lib/voxpupuli/test/spec_helper.rb +1 -8
- metadata +8 -9
- data/lib/voxpupuli/test.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4dd40401d3073603368776f98a93973f4a174469d47197de13fb0f767b37f3a4
|
4
|
+
data.tar.gz: 8ff8722876be3395a538da16ffdbcdd280275d703e2de43b8583e7e08c533632
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d31264b414af6224887a14b0ff6772daaf9f88899f5e289d5b55133e422f7597bad2d2a10c18d65887d5d16ec5069e585e852ab5e5c0ff876474c06b74ecdd4
|
7
|
+
data.tar.gz: 8309011ea81518fd8704a6f36afe30278305ca77d3e4d9ce42c42f51a0566b66fd5c39eb1b310029b1ae8e9529d9e4d64f2486414f0881b20a1a85f24d18cd68
|
data/README.md
CHANGED
@@ -9,7 +9,8 @@
|
|
9
9
|
|
10
10
|
This is a helper Gem to test the various Vox Pupuli Puppet modules. This Gem provides common functionality for rspec-puppet based testing. The aim is to reduce the boiler plate and need for modulesync.
|
11
11
|
|
12
|
-
|
12
|
+
## Usage
|
13
|
+
|
13
14
|
Add the `voxpupuli-test` Gem to your `Gemfile`:
|
14
15
|
|
15
16
|
```ruby
|
@@ -35,7 +36,17 @@ inherit_gem:
|
|
35
36
|
voxpupuli-test: rubocop.yml
|
36
37
|
```
|
37
38
|
|
38
|
-
|
39
|
+
## Rake tasks
|
40
|
+
|
41
|
+
### `check:trailing_whitespace`
|
42
|
+
|
43
|
+
The rake task `check:trailing_whitespace` checks for trailing whitespace in all markdown files in the repository.
|
44
|
+
It has an exclude pattern for: `%r{^((modules|acceptance|\.?vendor|spec/fixtures|pkg)/|REFERENCE.md)}`
|
45
|
+
|
46
|
+
We recommend using the GitHub style guide for markdown files, which includes no trailing whitespace.
|
47
|
+
See [GitHub Markdown Style Guide](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax)
|
48
|
+
|
49
|
+
## Fact handling
|
39
50
|
|
40
51
|
The recommended method is using [rspec-puppet-facts](https://github.com/mcanevet/rspec-puppet-facts) and is set up by default. This means the tests are writting as follows:
|
41
52
|
|
data/lib/voxpupuli/test/facts.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rspec-puppet-facts'
|
2
4
|
include RspecPuppetFacts
|
3
5
|
|
@@ -60,6 +62,7 @@ end
|
|
60
62
|
|
61
63
|
def normalize_module_name(name)
|
62
64
|
return unless name
|
65
|
+
|
63
66
|
name.sub('-', '/')
|
64
67
|
end
|
65
68
|
|
@@ -70,29 +73,25 @@ def add_stdlib_facts
|
|
70
73
|
|
71
74
|
# Rough conversion of grepping in the puppet source:
|
72
75
|
# grep defaultfor lib/puppet/provider/service/*.rb
|
73
|
-
add_custom_fact :service_provider,
|
76
|
+
add_custom_fact :service_provider, lambda { |_os, facts|
|
74
77
|
os = RSpec.configuration.facterdb_string_keys ? facts['os'] : facts[:os]
|
75
78
|
case os['family'].downcase
|
76
|
-
when 'archlinux'
|
79
|
+
when 'archlinux', 'debian', 'redhat'
|
77
80
|
'systemd'
|
78
81
|
when 'darwin'
|
79
82
|
'launchd'
|
80
|
-
when 'debian'
|
81
|
-
'systemd'
|
82
83
|
when 'freebsd'
|
83
84
|
'freebsd'
|
84
85
|
when 'gentoo'
|
85
86
|
'openrc'
|
86
87
|
when 'openbsd'
|
87
88
|
'openbsd'
|
88
|
-
when 'redhat'
|
89
|
-
'systemd'
|
90
89
|
when 'suse'
|
91
|
-
os['release']['major'].to_i >= 12 ? 'systemd' : 'redhat'
|
90
|
+
(os['release']['major'].to_i >= 12) ? 'systemd' : 'redhat'
|
92
91
|
when 'windows'
|
93
92
|
'windows'
|
94
93
|
else
|
95
94
|
'init'
|
96
95
|
end
|
97
|
-
|
96
|
+
}
|
98
97
|
end
|
data/lib/voxpupuli/test/rake.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'puppetlabs_spec_helper/rake_tasks'
|
2
4
|
|
3
|
-
PuppetLint.configuration.log_format = '
|
5
|
+
PuppetLint.configuration.log_format = '%<path>s:%<line>s:%<check>s:%<KIND>s:%<message>s'
|
4
6
|
# without this, puppet-lint always gives an exit code of 0
|
5
7
|
PuppetLint.configuration.fail_on_warnings = true
|
6
8
|
|
@@ -12,15 +14,23 @@ task default: [:release_checks]
|
|
12
14
|
namespace :check do
|
13
15
|
desc 'Check for trailing whitespace'
|
14
16
|
task :trailing_whitespace do
|
17
|
+
errors = []
|
18
|
+
|
15
19
|
Dir.glob('**/*.md', File::FNM_DOTMATCH).sort.each do |filename|
|
16
20
|
next if filename =~ %r{^((modules|acceptance|\.?vendor|spec/fixtures|pkg)/|REFERENCE.md)}
|
21
|
+
|
17
22
|
File.foreach(filename).each_with_index do |line, index|
|
18
|
-
if line =~
|
19
|
-
|
20
|
-
exit 1
|
23
|
+
if line =~ /\s\n$/
|
24
|
+
errors << "#{filename} has trailing whitespace on line #{index + 1}"
|
21
25
|
end
|
22
26
|
end
|
23
27
|
end
|
28
|
+
|
29
|
+
if errors.any?
|
30
|
+
errors.each { |error| puts error }
|
31
|
+
exit 1
|
32
|
+
end
|
24
33
|
end
|
25
34
|
end
|
35
|
+
|
26
36
|
Rake::Task[:check].enhance ['check:trailing_whitespace']
|
@@ -1,11 +1,4 @@
|
|
1
|
-
|
2
|
-
# puppetlabs_spec_helper defaults to mocha but emits a deprecation warning
|
3
|
-
# Vox Pupuli prefers rspec to avoid the deprecation warning unless explicitly
|
4
|
-
# set
|
5
|
-
if config.instance_variable_get(:@mock_framework).nil?
|
6
|
-
config.mock_with :rspec
|
7
|
-
end
|
8
|
-
end
|
1
|
+
# frozen_string_literal: true
|
9
2
|
|
10
3
|
require 'voxpupuli/test/facts'
|
11
4
|
require 'puppetlabs_spec_helper/module_spec_helper'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: voxpupuli-test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.
|
4
|
+
version: 8.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vox Pupuli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -157,33 +157,33 @@ dependencies:
|
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: 1.50.0
|
159
159
|
- !ruby/object:Gem::Dependency
|
160
|
-
name: rubocop-
|
160
|
+
name: rubocop-rake
|
161
161
|
requirement: !ruby/object:Gem::Requirement
|
162
162
|
requirements:
|
163
163
|
- - "~>"
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version:
|
165
|
+
version: 0.6.0
|
166
166
|
type: :runtime
|
167
167
|
prerelease: false
|
168
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
169
|
requirements:
|
170
170
|
- - "~>"
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version:
|
172
|
+
version: 0.6.0
|
173
173
|
- !ruby/object:Gem::Dependency
|
174
|
-
name: rubocop-
|
174
|
+
name: rubocop-rspec
|
175
175
|
requirement: !ruby/object:Gem::Requirement
|
176
176
|
requirements:
|
177
177
|
- - "~>"
|
178
178
|
- !ruby/object:Gem::Version
|
179
|
-
version:
|
179
|
+
version: 2.20.0
|
180
180
|
type: :runtime
|
181
181
|
prerelease: false
|
182
182
|
version_requirements: !ruby/object:Gem::Requirement
|
183
183
|
requirements:
|
184
184
|
- - "~>"
|
185
185
|
- !ruby/object:Gem::Version
|
186
|
-
version:
|
186
|
+
version: 2.20.0
|
187
187
|
- !ruby/object:Gem::Dependency
|
188
188
|
name: voxpupuli-puppet-lint-plugins
|
189
189
|
requirement: !ruby/object:Gem::Requirement
|
@@ -222,7 +222,6 @@ extra_rdoc_files: []
|
|
222
222
|
files:
|
223
223
|
- LICENSE
|
224
224
|
- README.md
|
225
|
-
- lib/voxpupuli/test.rb
|
226
225
|
- lib/voxpupuli/test/facts.rb
|
227
226
|
- lib/voxpupuli/test/rake.rb
|
228
227
|
- lib/voxpupuli/test/spec_helper.rb
|
data/lib/voxpupuli/test.rb
DELETED
File without changes
|