puppetlabs_spec_helper 2.15.0 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +25 -4
- data/.rubocop_todo.yml +26 -16
- data/.travis.yml +8 -8
- data/CHANGELOG.md +28 -2
- data/Gemfile +8 -5
- data/README.md +4 -0
- data/Rakefile +1 -1
- data/lib/puppetlabs_spec_helper/module_spec_helper.rb +10 -0
- data/lib/puppetlabs_spec_helper/puppet_spec_helper.rb +4 -2
- data/lib/puppetlabs_spec_helper/puppetlabs_spec/files.rb +2 -0
- data/lib/puppetlabs_spec_helper/puppetlabs_spec/fixtures.rb +7 -2
- data/lib/puppetlabs_spec_helper/puppetlabs_spec/matchers.rb +4 -2
- data/lib/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals.rb +3 -0
- data/lib/puppetlabs_spec_helper/puppetlabs_spec_helper.rb +2 -0
- data/lib/puppetlabs_spec_helper/rake_tasks.rb +26 -17
- data/lib/puppetlabs_spec_helper/tasks/beaker.rb +12 -9
- data/lib/puppetlabs_spec_helper/tasks/check_symlinks.rb +4 -1
- data/lib/puppetlabs_spec_helper/tasks/fixtures.rb +30 -14
- data/lib/puppetlabs_spec_helper/version.rb +3 -1
- data/puppet_spec_helper.rb +2 -0
- data/puppetlabs_spec_helper.gemspec +5 -5
- data/puppetlabs_spec_helper.rb +2 -0
- metadata +52 -47
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 77cf85ee1cb6e0c063fc70b7633745f22e1a74db5dd004addd055b11a3b2d3aa
|
|
4
|
+
data.tar.gz: 509b75a40c8e4041dbdd73a2f01bed57f141ebd0c44d695551ed3aa554e67d3f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2c6b745e80ddc0b9d2bad8f902f9155252cf5d8503f8cc1052b3a1f8dc647646701a36145dff46b17bdeaff04e53a32d2927401faf619bfec3ac0fa61212adad
|
|
7
|
+
data.tar.gz: 5fb4f21feb106e531d3b5112494fba80e3deab0775d16bcbf559133cccd06259e3ad5e69d9dd055f4024282c299be9b1aceb38d7d7e5be2074a4a808531dbb64
|
data/.rubocop.yml
CHANGED
|
@@ -2,7 +2,9 @@ require: rubocop-rspec
|
|
|
2
2
|
inherit_from: .rubocop_todo.yml
|
|
3
3
|
|
|
4
4
|
AllCops:
|
|
5
|
-
TargetRubyVersion: 1
|
|
5
|
+
TargetRubyVersion: 2.1
|
|
6
|
+
# let dependabot find the rough spots for us
|
|
7
|
+
NewCops: enable
|
|
6
8
|
Exclude:
|
|
7
9
|
# binstubs, and other utilities
|
|
8
10
|
- bin/**/*
|
|
@@ -14,7 +16,7 @@ AllCops:
|
|
|
14
16
|
- package-testing/vendor/**/*
|
|
15
17
|
- package-testing/vendor/**/.*
|
|
16
18
|
|
|
17
|
-
Layout/
|
|
19
|
+
Layout/HeredocIndentation:
|
|
18
20
|
Description: The `squiggly` style would be preferable, but is only available from ruby 2.3. We'll enable this when we can.
|
|
19
21
|
Enabled: False
|
|
20
22
|
|
|
@@ -34,7 +36,7 @@ Metrics/ClassLength:
|
|
|
34
36
|
Metrics/CyclomaticComplexity:
|
|
35
37
|
Enabled: False
|
|
36
38
|
|
|
37
|
-
|
|
39
|
+
Layout/LineLength:
|
|
38
40
|
Description: People have wide screens, use them.
|
|
39
41
|
Max: 200
|
|
40
42
|
|
|
@@ -128,7 +130,11 @@ Style/TrailingCommaInArguments:
|
|
|
128
130
|
Description: Prefer always trailing comma on multiline argument lists. This makes diffs, and re-ordering nicer.
|
|
129
131
|
EnforcedStyleForMultiline: comma
|
|
130
132
|
|
|
131
|
-
Style/
|
|
133
|
+
Style/TrailingCommaInArrayLiteral:
|
|
134
|
+
Description: Prefer always trailing comma on multiline literals. This makes diffs, and re-ordering nicer.
|
|
135
|
+
EnforcedStyleForMultiline: comma
|
|
136
|
+
|
|
137
|
+
Style/TrailingCommaInHashLiteral:
|
|
132
138
|
Description: Prefer always trailing comma on multiline literals. This makes diffs, and re-ordering nicer.
|
|
133
139
|
EnforcedStyleForMultiline: comma
|
|
134
140
|
|
|
@@ -140,3 +146,18 @@ Style/SymbolArray:
|
|
|
140
146
|
# Enforce LF line endings, even when on Windows
|
|
141
147
|
Layout/EndOfLine:
|
|
142
148
|
EnforcedStyle: lf
|
|
149
|
+
|
|
150
|
+
RSpec/FactoryBot/CreateList:
|
|
151
|
+
Description: produces lots of errors (not violations) with out code
|
|
152
|
+
Enabled: false
|
|
153
|
+
|
|
154
|
+
Style/AccessModifierDeclarations:
|
|
155
|
+
EnforcedStyle: inline
|
|
156
|
+
|
|
157
|
+
RSpec/ContextWording:
|
|
158
|
+
Prefixes:
|
|
159
|
+
- and
|
|
160
|
+
- but
|
|
161
|
+
- when
|
|
162
|
+
- with
|
|
163
|
+
- without
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,29 +1,37 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on
|
|
3
|
+
# on 2020-11-16 16:15:06 +0000 using RuboCop version 0.57.2.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
8
8
|
|
|
9
|
-
# Offense count: 4
|
|
10
|
-
# Configuration parameters: AllowSafeAssignment.
|
|
11
|
-
Lint/AssignmentInCondition:
|
|
12
|
-
Exclude:
|
|
13
|
-
- 'lib/puppetlabs_spec_helper/puppetlabs_spec/files.rb'
|
|
14
|
-
- 'lib/puppetlabs_spec_helper/puppetlabs_spec/fixtures.rb'
|
|
15
|
-
- 'lib/puppetlabs_spec_helper/rake_tasks.rb'
|
|
16
|
-
|
|
17
9
|
# Offense count: 2
|
|
18
10
|
# Cop supports --auto-correct.
|
|
19
|
-
# Configuration parameters: EnforcedStyleAlignWith,
|
|
11
|
+
# Configuration parameters: EnforcedStyleAlignWith, AutoCorrect, Severity.
|
|
20
12
|
# SupportedStylesAlignWith: keyword, variable, start_of_line
|
|
21
|
-
|
|
13
|
+
Layout/EndAlignment:
|
|
22
14
|
Exclude:
|
|
23
15
|
- 'lib/puppetlabs_spec_helper/rake_tasks.rb'
|
|
24
16
|
- 'spec/watchr.rb'
|
|
25
17
|
|
|
18
|
+
# Offense count: 1
|
|
19
|
+
# Cop supports --auto-correct.
|
|
20
|
+
# Configuration parameters: EnforcedStyle.
|
|
21
|
+
# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
|
|
22
|
+
Layout/IndentHeredoc:
|
|
23
|
+
Exclude:
|
|
24
|
+
- 'lib/puppetlabs_spec_helper/rake_tasks.rb'
|
|
25
|
+
|
|
26
26
|
# Offense count: 4
|
|
27
|
+
# Configuration parameters: AllowSafeAssignment.
|
|
28
|
+
Lint/AssignmentInCondition:
|
|
29
|
+
Exclude:
|
|
30
|
+
- 'lib/puppetlabs_spec_helper/puppetlabs_spec/files.rb'
|
|
31
|
+
- 'lib/puppetlabs_spec_helper/puppetlabs_spec/fixtures.rb'
|
|
32
|
+
- 'lib/puppetlabs_spec_helper/rake_tasks.rb'
|
|
33
|
+
|
|
34
|
+
# Offense count: 7
|
|
27
35
|
Lint/HandleExceptions:
|
|
28
36
|
Exclude:
|
|
29
37
|
- 'lib/puppetlabs_spec_helper/puppet_spec_helper.rb'
|
|
@@ -50,10 +58,11 @@ RSpec/InstanceVariable:
|
|
|
50
58
|
- 'spec/acceptance/smoke_spec.rb'
|
|
51
59
|
|
|
52
60
|
# Offense count: 6
|
|
61
|
+
# Configuration parameters: AggregateFailuresByDefault.
|
|
53
62
|
RSpec/MultipleExpectations:
|
|
54
63
|
Max: 3
|
|
55
64
|
|
|
56
|
-
# Offense count:
|
|
65
|
+
# Offense count: 18
|
|
57
66
|
RSpec/NamedSubject:
|
|
58
67
|
Exclude:
|
|
59
68
|
- 'spec/unit/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals_spec.rb'
|
|
@@ -71,7 +80,8 @@ Security/Eval:
|
|
|
71
80
|
- 'lib/puppetlabs_spec_helper/tasks/fixtures.rb'
|
|
72
81
|
|
|
73
82
|
# Offense count: 4
|
|
74
|
-
#
|
|
83
|
+
# Cop supports --auto-correct.
|
|
84
|
+
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
|
75
85
|
# SupportedStyles: nested, compact
|
|
76
86
|
Style/ClassAndModuleChildren:
|
|
77
87
|
Exclude:
|
|
@@ -79,7 +89,7 @@ Style/ClassAndModuleChildren:
|
|
|
79
89
|
- 'lib/puppetlabs_spec_helper/puppetlabs_spec/matchers.rb'
|
|
80
90
|
- 'lib/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals.rb'
|
|
81
91
|
|
|
82
|
-
# Offense count:
|
|
92
|
+
# Offense count: 14
|
|
83
93
|
Style/Documentation:
|
|
84
94
|
Exclude:
|
|
85
95
|
- 'spec/**/*'
|
|
@@ -88,8 +98,8 @@ Style/Documentation:
|
|
|
88
98
|
- 'lib/puppetlabs_spec_helper/puppetlabs_spec/matchers.rb'
|
|
89
99
|
- 'lib/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals.rb'
|
|
90
100
|
- 'lib/puppetlabs_spec_helper/tasks/beaker.rb'
|
|
91
|
-
- 'lib/puppetlabs_spec_helper/tasks/fixtures.rb'
|
|
92
101
|
- 'lib/puppetlabs_spec_helper/tasks/check_symlinks.rb'
|
|
102
|
+
- 'lib/puppetlabs_spec_helper/tasks/fixtures.rb'
|
|
93
103
|
|
|
94
104
|
# Offense count: 1
|
|
95
105
|
Style/DoubleNegation:
|
|
@@ -111,7 +121,7 @@ Style/GuardClause:
|
|
|
111
121
|
|
|
112
122
|
# Offense count: 1
|
|
113
123
|
# Cop supports --auto-correct.
|
|
114
|
-
# Configuration parameters: AutoCorrect, EnforcedStyle
|
|
124
|
+
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
|
115
125
|
# SupportedStyles: predicate, comparison
|
|
116
126
|
Style/NumericPredicate:
|
|
117
127
|
Exclude:
|
data/.travis.yml
CHANGED
|
@@ -3,28 +3,28 @@ dist: xenial
|
|
|
3
3
|
language: ruby
|
|
4
4
|
cache: bundler
|
|
5
5
|
before_install: bundle -v
|
|
6
|
-
script:
|
|
7
|
-
|
|
6
|
+
script: bundle exec rake
|
|
7
|
+
matrix:
|
|
8
8
|
fast_finish: true
|
|
9
9
|
include:
|
|
10
10
|
- rvm: '2.7'
|
|
11
|
-
env: PUPPET_GEM_VERSION='https://github.com/puppetlabs/puppet.git#
|
|
11
|
+
env: PUPPET_GEM_VERSION='https://github.com/puppetlabs/puppet.git#main' # TODO: change to 7 once it becomes available
|
|
12
12
|
- rvm: '2.6'
|
|
13
|
-
env: PUPPET_GEM_VERSION='~> 6.0'
|
|
13
|
+
env: PUPPET_GEM_VERSION='~> 6.0' COVERAGE=yes
|
|
14
14
|
- rvm: '2.5'
|
|
15
|
-
env: PUPPET_GEM_VERSION='~> 6.0'
|
|
15
|
+
env: PUPPET_GEM_VERSION='~> 6.0' COVERAGE=yes
|
|
16
16
|
- rvm: '2.4'
|
|
17
|
-
env: PUPPET_GEM_VERSION='~> 6.0'
|
|
17
|
+
env: PUPPET_GEM_VERSION='~> 6.0' COVERAGE=yes
|
|
18
18
|
- rvm: '2.3'
|
|
19
19
|
env: PUPPET_GEM_VERSION='~> 6.0'
|
|
20
20
|
- rvm: '2.4'
|
|
21
|
-
env: PUPPET_GEM_VERSION='~> 5.0'
|
|
21
|
+
env: PUPPET_GEM_VERSION='~> 5.0' COVERAGE=yes
|
|
22
22
|
- rvm: '2.3'
|
|
23
23
|
env: PUPPET_GEM_VERSION='~> 5.0'
|
|
24
24
|
- rvm: '2.1'
|
|
25
25
|
env: PUPPET_GEM_VERSION='~> 5.0'
|
|
26
26
|
- rvm: '2.4'
|
|
27
|
-
env: PUPPET_GEM_VERSION='~> 4.0'
|
|
27
|
+
env: PUPPET_GEM_VERSION='~> 4.0' COVERAGE=yes
|
|
28
28
|
- rvm: '2.3'
|
|
29
29
|
env: PUPPET_GEM_VERSION='~> 4.0'
|
|
30
30
|
- rvm: '2.1'
|
data/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,23 @@
|
|
|
3
3
|
All significant changes to this repo will be summarized in this file.
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
## [v2.
|
|
6
|
+
## [v2.16.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.16.0) (2021-01-18)
|
|
7
|
+
|
|
8
|
+
[Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.15.0...v2.16.0)
|
|
9
|
+
|
|
10
|
+
**Implemented enhancements:**
|
|
11
|
+
|
|
12
|
+
- Add a check task [\#327](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/327) ([ekohl](https://github.com/ekohl))
|
|
13
|
+
- Update fixtures from forge when the module version doesn't match; fix git \< 2.7 compatibility [\#269](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/269) ([nabertrand](https://github.com/nabertrand))
|
|
14
|
+
- Add all spec/lib directories from fixtures to LOAD\_PATH [\#233](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/233) ([nabertrand](https://github.com/nabertrand))
|
|
15
|
+
|
|
16
|
+
**Merged pull requests:**
|
|
17
|
+
|
|
18
|
+
- Update pathspec requirement from ~\> 0.2.1 to \>= 0.2.1, \< 1.1.0 [\#328](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/328) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
|
19
|
+
- Update rubocop requirement from = 0.49 to 0.57.2; prepare for future move to 1.3.1 [\#322](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/322) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
|
20
|
+
|
|
21
|
+
## [v2.15.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.15.0) (2020-06-12)
|
|
22
|
+
|
|
7
23
|
[Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.14.1...v2.15.0)
|
|
8
24
|
|
|
9
25
|
**Implemented enhancements:**
|
|
@@ -19,6 +35,7 @@ All significant changes to this repo will be summarized in this file.
|
|
|
19
35
|
|
|
20
36
|
**Merged pull requests:**
|
|
21
37
|
|
|
38
|
+
- \(IAC-885\) - Release Prep 2.15.0 [\#318](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/318) ([pmcmaw](https://github.com/pmcmaw))
|
|
22
39
|
- \(IAC-859\) Update all the gems and ruby to 2.7 [\#316](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/316) ([DavidS](https://github.com/DavidS))
|
|
23
40
|
- Support git fixture branches containing slashes [\#297](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/297) ([trevor-vaughan](https://github.com/trevor-vaughan))
|
|
24
41
|
- \(maint\) Require pdk/util in build:pdk rake task [\#295](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/295) ([rodjek](https://github.com/rodjek))
|
|
@@ -29,6 +46,7 @@ All significant changes to this repo will be summarized in this file.
|
|
|
29
46
|
- Download forge modules in parallel [\#284](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/284) ([logicminds](https://github.com/logicminds))
|
|
30
47
|
|
|
31
48
|
## [v2.14.1](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.14.1) (2019-03-26)
|
|
49
|
+
|
|
32
50
|
[Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.14.0...v2.14.1)
|
|
33
51
|
|
|
34
52
|
**Fixed bugs:**
|
|
@@ -40,6 +58,7 @@ All significant changes to this repo will be summarized in this file.
|
|
|
40
58
|
- \(MODULES-8778\) - Release Prep 2.14.1 [\#287](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/287) ([pmcmaw](https://github.com/pmcmaw))
|
|
41
59
|
|
|
42
60
|
## [v2.14.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.14.0) (2019-03-25)
|
|
61
|
+
|
|
43
62
|
[Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.13.1...v2.14.0)
|
|
44
63
|
|
|
45
64
|
**Implemented enhancements:**
|
|
@@ -57,6 +76,7 @@ All significant changes to this repo will be summarized in this file.
|
|
|
57
76
|
- \(MODULES-8771\) - Release Prep 2.14.0 [\#282](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/282) ([pmcmaw](https://github.com/pmcmaw))
|
|
58
77
|
|
|
59
78
|
## [v2.13.1](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.13.1) (2019-01-15)
|
|
79
|
+
|
|
60
80
|
[Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.13.0...v2.13.1)
|
|
61
81
|
|
|
62
82
|
**Fixed bugs:**
|
|
@@ -68,6 +88,7 @@ All significant changes to this repo will be summarized in this file.
|
|
|
68
88
|
- Release Prep 2.13.1 [\#276](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/276) ([bmjen](https://github.com/bmjen))
|
|
69
89
|
|
|
70
90
|
## [v2.13.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.13.0) (2019-01-11)
|
|
91
|
+
|
|
71
92
|
[Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.12.0...v2.13.0)
|
|
72
93
|
|
|
73
94
|
**Implemented enhancements:**
|
|
@@ -87,6 +108,7 @@ All significant changes to this repo will be summarized in this file.
|
|
|
87
108
|
- \(MAINT\) Add Plans Path Exclusion [\#270](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/270) ([RandomNoun7](https://github.com/RandomNoun7))
|
|
88
109
|
|
|
89
110
|
## [v2.12.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.12.0) (2018-11-08)
|
|
111
|
+
|
|
90
112
|
[Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.11.0...v2.12.0)
|
|
91
113
|
|
|
92
114
|
**Implemented enhancements:**
|
|
@@ -104,6 +126,7 @@ All significant changes to this repo will be summarized in this file.
|
|
|
104
126
|
- 2.12.0 Release Prep [\#264](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/264) ([tphoney](https://github.com/tphoney))
|
|
105
127
|
|
|
106
128
|
## [v2.11.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.11.0) (2018-09-26)
|
|
129
|
+
|
|
107
130
|
[Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.10.0...v2.11.0)
|
|
108
131
|
|
|
109
132
|
**Implemented enhancements:**
|
|
@@ -119,6 +142,7 @@ All significant changes to this repo will be summarized in this file.
|
|
|
119
142
|
- \(MODULES-7858\) - 2.11.0 Release Prep [\#259](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/259) ([pmcmaw](https://github.com/pmcmaw))
|
|
120
143
|
|
|
121
144
|
## [v2.10.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.10.0) (2018-08-30)
|
|
145
|
+
|
|
122
146
|
[Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.9.1...v2.10.0)
|
|
123
147
|
|
|
124
148
|
**Implemented enhancements:**
|
|
@@ -133,6 +157,7 @@ All significant changes to this repo will be summarized in this file.
|
|
|
133
157
|
- update README [\#252](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/252) ([b4ldr](https://github.com/b4ldr))
|
|
134
158
|
|
|
135
159
|
## [v2.9.1](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.9.1) (2018-06-20)
|
|
160
|
+
|
|
136
161
|
[Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.9.0...v2.9.1)
|
|
137
162
|
|
|
138
163
|
**Fixed bugs:**
|
|
@@ -145,6 +170,7 @@ All significant changes to this repo will be summarized in this file.
|
|
|
145
170
|
- \(maint\) - Release prep for 2.9.1 [\#251](https://github.com/puppetlabs/puppetlabs_spec_helper/pull/251) ([pmcmaw](https://github.com/pmcmaw))
|
|
146
171
|
|
|
147
172
|
## [v2.9.0](https://github.com/puppetlabs/puppetlabs_spec_helper/tree/v2.9.0) (2018-06-18)
|
|
173
|
+
|
|
148
174
|
[Full Changelog](https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.8.0...v2.9.0)
|
|
149
175
|
|
|
150
176
|
**Implemented enhancements:**
|
|
@@ -656,4 +682,4 @@ compatible yet.
|
|
|
656
682
|
[0.1.0]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.0.0...0.1.0
|
|
657
683
|
|
|
658
684
|
|
|
659
|
-
\* *This
|
|
685
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/Gemfile
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
|
|
2
4
|
|
|
3
5
|
def location_for(place_or_version, fake_version = nil)
|
|
4
|
-
git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(
|
|
5
|
-
file_url_regex = %r{\Afile
|
|
6
|
+
git_url_regex = %r{\A(?<url>(?:https?|git)[:@][^#]*)(?:#(?<branch>.*))?}
|
|
7
|
+
file_url_regex = %r{\Afile://(?<path>.*)}
|
|
6
8
|
|
|
7
9
|
if place_or_version && (git_url = place_or_version.match(git_url_regex))
|
|
8
10
|
[fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
|
|
@@ -22,6 +24,7 @@ def infer_puppet_version
|
|
|
22
24
|
ruby_ver = Gem::Version.new(RUBY_VERSION.dup)
|
|
23
25
|
return '~> 6.0' if ruby_ver >= Gem::Version.new('2.5.0')
|
|
24
26
|
return '~> 5.0' if ruby_ver >= Gem::Version.new('2.4.0')
|
|
27
|
+
|
|
25
28
|
'~> 4.0'
|
|
26
29
|
end
|
|
27
30
|
|
|
@@ -31,9 +34,9 @@ group :development do
|
|
|
31
34
|
gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'] || ENV['PUPPET_VERSION'] || infer_puppet_version)
|
|
32
35
|
gem 'simplecov', '~> 0'
|
|
33
36
|
gem 'simplecov-console'
|
|
34
|
-
if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.
|
|
35
|
-
gem 'rubocop', '
|
|
36
|
-
gem 'rubocop-rspec'
|
|
37
|
+
if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.4')
|
|
38
|
+
gem 'rubocop', '0.57.2'
|
|
39
|
+
gem 'rubocop-rspec'
|
|
37
40
|
end
|
|
38
41
|
end
|
|
39
42
|
|
data/README.md
CHANGED
|
@@ -335,6 +335,10 @@ fixtures:
|
|
|
335
335
|
ref: "2.6.0"
|
|
336
336
|
```
|
|
337
337
|
|
|
338
|
+
Fixture Loading
|
|
339
|
+
---------------
|
|
340
|
+
Any module that has a `spec/lib` directory will be available on the ruby `LOAD_PATH` for tests to consume. This allows modules to provide additional helper code to be supplied. The [augeasprovider_core](https://github.com/hercules-team/augeasproviders_core) module has [some examples](https://github.com/hercules-team/augeasproviders_core/tree/master/spec/lib).
|
|
341
|
+
|
|
338
342
|
Testing Parser Functions
|
|
339
343
|
========================
|
|
340
344
|
|
data/Rakefile
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'rspec-puppet'
|
|
2
4
|
require 'puppetlabs_spec_helper/puppet_spec_helper'
|
|
3
5
|
require 'puppetlabs_spec_helper/puppetlabs_spec/puppet_internals'
|
|
@@ -50,6 +52,14 @@ if ENV['SIMPLECOV'] == 'yes'
|
|
|
50
52
|
end
|
|
51
53
|
end
|
|
52
54
|
|
|
55
|
+
# Add all spec lib dirs to LOAD_PATH
|
|
56
|
+
components = module_path.split(File::PATH_SEPARATOR).collect do |dir|
|
|
57
|
+
Dir.entries(dir).reject { |f| f =~ %r{^\.} }.collect { |f| File.join(dir, f, 'spec', 'lib') }
|
|
58
|
+
end
|
|
59
|
+
components.flatten.each do |d|
|
|
60
|
+
$LOAD_PATH << d if FileTest.directory?(d) && !$LOAD_PATH.include?(d)
|
|
61
|
+
end
|
|
62
|
+
|
|
53
63
|
RSpec.configure do |c|
|
|
54
64
|
c.environmentpath = spec_path if Puppet.version.to_f >= 4.0
|
|
55
65
|
c.module_path = module_path
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'puppetlabs_spec_helper/puppetlabs_spec_helper'
|
|
2
4
|
|
|
3
5
|
# Don't want puppet getting the command line arguments for rake or autotest
|
|
@@ -45,7 +47,7 @@ require 'puppetlabs_spec_helper/puppetlabs_spec/files'
|
|
|
45
47
|
# to compatibility mode for older versions of puppet.
|
|
46
48
|
begin
|
|
47
49
|
require 'puppet/test/test_helper'
|
|
48
|
-
rescue LoadError =>
|
|
50
|
+
rescue LoadError => e
|
|
49
51
|
end
|
|
50
52
|
|
|
51
53
|
# This is just a utility class to allow us to isolate the various version-specific
|
|
@@ -58,7 +60,7 @@ module Puppet
|
|
|
58
60
|
# Puppet's Settings singleton object, and other fun implementation details
|
|
59
61
|
# that code external to puppet should really never know about.
|
|
60
62
|
def self.initialize_via_fallback_compatibility(config)
|
|
61
|
-
|
|
63
|
+
warn('Warning: you appear to be using an older version of puppet; spec_helper will use fallback compatibility mode.')
|
|
62
64
|
config.before :all do
|
|
63
65
|
# nothing to do for now
|
|
64
66
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# This module provides some helper methods to assist with fixtures. It's
|
|
2
4
|
# methods are designed to help when you have a conforming fixture layout so we
|
|
3
5
|
# get project consistency.
|
|
@@ -14,6 +16,7 @@ module PuppetlabsSpec::Fixtures
|
|
|
14
16
|
callers = caller
|
|
15
17
|
while line = callers.shift
|
|
16
18
|
next unless found = line.match(%r{/spec/(.*)_spec\.rb:})
|
|
19
|
+
|
|
17
20
|
return fixtures(found[1])
|
|
18
21
|
end
|
|
19
22
|
raise "sorry, I couldn't work out your path from the caller stack!"
|
|
@@ -26,6 +29,7 @@ module PuppetlabsSpec::Fixtures
|
|
|
26
29
|
unless File.readable? file
|
|
27
30
|
raise "fixture '#{name}' for #{my_fixture_dir} is not readable"
|
|
28
31
|
end
|
|
32
|
+
|
|
29
33
|
file
|
|
30
34
|
end
|
|
31
35
|
|
|
@@ -37,12 +41,13 @@ module PuppetlabsSpec::Fixtures
|
|
|
37
41
|
|
|
38
42
|
# Provides a block mechanism for iterating across the files in your fixture
|
|
39
43
|
# area.
|
|
40
|
-
def my_fixtures(glob = '*', flags = 0)
|
|
44
|
+
def my_fixtures(glob = '*', flags = 0, &block)
|
|
41
45
|
files = Dir.glob(File.join(my_fixture_dir, glob), flags)
|
|
42
46
|
if files.empty?
|
|
43
47
|
raise "fixture '#{glob}' for #{my_fixture_dir} had no files!"
|
|
44
48
|
end
|
|
45
|
-
|
|
49
|
+
|
|
50
|
+
block_given? && files.each(&block)
|
|
46
51
|
files
|
|
47
52
|
end
|
|
48
53
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'stringio'
|
|
2
4
|
require 'rspec/expectations'
|
|
3
5
|
|
|
@@ -6,8 +8,8 @@ require 'rspec/expectations'
|
|
|
6
8
|
module RSpec
|
|
7
9
|
module Matchers
|
|
8
10
|
module BlockAliases
|
|
9
|
-
if method_defined? :
|
|
10
|
-
alias to should
|
|
11
|
+
if method_defined?(:should) && !method_defined?(:to)
|
|
12
|
+
alias to should
|
|
11
13
|
end
|
|
12
14
|
if method_defined? :should_not
|
|
13
15
|
alias to_not should_not unless method_defined? :to_not
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# Initialize puppet for testing by loading the
|
|
2
4
|
# 'puppetlabs_spec_helper/puppet_spec_helper' library
|
|
3
5
|
require 'puppetlabs_spec_helper/puppet_spec_helper'
|
|
@@ -67,6 +69,7 @@ module PuppetlabsSpec
|
|
|
67
69
|
# exists. This is a hack, but at least it's a hidden hack and not an
|
|
68
70
|
# exposed hack.
|
|
69
71
|
return nil unless Puppet::Parser::Functions.function(name)
|
|
72
|
+
|
|
70
73
|
scope.method("function_#{name}".intern)
|
|
71
74
|
end
|
|
72
75
|
module_function :function_method
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'fileutils'
|
|
2
4
|
require 'rake'
|
|
3
5
|
require 'rspec/core/rake_task'
|
|
@@ -53,6 +55,7 @@ RSpec::Core::RakeTask.new(:spec_standalone) do |t, args|
|
|
|
53
55
|
ci_total = ENV['CI_NODE_TOTAL'].to_i
|
|
54
56
|
ci_index = ENV['CI_NODE_INDEX'].to_i
|
|
55
57
|
raise "CI_NODE_INDEX must be between 1-#{ci_total}" unless ci_index >= 1 && ci_index <= ci_total
|
|
58
|
+
|
|
56
59
|
files = Rake::FileList[pattern].to_a
|
|
57
60
|
per_node = (files.size / ci_total.to_f).ceil
|
|
58
61
|
t.pattern = if args.extras.nil? || args.extras.empty?
|
|
@@ -108,16 +111,17 @@ end
|
|
|
108
111
|
desc 'Parallel spec tests'
|
|
109
112
|
task :parallel_spec_standalone do |_t, args|
|
|
110
113
|
raise 'Add the parallel_tests gem to Gemfile to enable this task' unless parallel_tests_loaded
|
|
114
|
+
|
|
111
115
|
if Rake::FileList[pattern].to_a.empty?
|
|
112
116
|
warn 'No files for parallel_spec to run against'
|
|
113
117
|
else
|
|
114
|
-
begin
|
|
115
|
-
args = ['-t', 'rspec']
|
|
116
|
-
args.push('--').concat(ENV['CI_SPEC_OPTIONS'].strip.split(' ')).push('--') unless ENV['CI_SPEC_OPTIONS'].nil? || ENV['CI_SPEC_OPTIONS'].strip.empty?
|
|
117
|
-
args.concat(Rake::FileList[pattern].to_a)
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
args = ['-t', 'rspec']
|
|
120
|
+
args.push('--').concat(ENV['CI_SPEC_OPTIONS'].strip.split(' ')).push('--') unless ENV['CI_SPEC_OPTIONS'].nil? || ENV['CI_SPEC_OPTIONS'].strip.empty?
|
|
121
|
+
args.concat(Rake::FileList[pattern].to_a)
|
|
122
|
+
|
|
123
|
+
ParallelTests::CLI.new.run(args)
|
|
124
|
+
|
|
121
125
|
end
|
|
122
126
|
end
|
|
123
127
|
|
|
@@ -150,7 +154,7 @@ namespace :build do
|
|
|
150
154
|
rescue LoadError
|
|
151
155
|
_ = `pdk --version`
|
|
152
156
|
unless $CHILD_STATUS.success?
|
|
153
|
-
|
|
157
|
+
warn 'Unable to build module. Please install PDK or add the `pdk` gem to your Gemfile.'
|
|
154
158
|
abort
|
|
155
159
|
end
|
|
156
160
|
|
|
@@ -263,7 +267,7 @@ task :compute_dev_version do
|
|
|
263
267
|
version = modinfo['version']
|
|
264
268
|
elsif File.exist?('Modulefile')
|
|
265
269
|
modfile = File.read('Modulefile')
|
|
266
|
-
version = modfile.match(%r{\nversion
|
|
270
|
+
version = modfile.match(%r{\nversion +['"](.*)['"]})[1]
|
|
267
271
|
else
|
|
268
272
|
raise 'Could not find a metadata.json or Modulefile! Cannot compute dev version without one or the other!'
|
|
269
273
|
end
|
|
@@ -277,10 +281,10 @@ task :compute_dev_version do
|
|
|
277
281
|
# More info can be found at https://tickets.puppetlabs.com/browse/FM-6170
|
|
278
282
|
new_version = if build = ENV['BUILD_NUMBER'] || ENV['TRAVIS_BUILD_NUMBER']
|
|
279
283
|
if branch.eql? 'release'
|
|
280
|
-
'%s-%s%04d-%s' % [version, 'r', build, sha]
|
|
284
|
+
'%s-%s%04d-%s' % [version, 'r', build, sha] # legacy support code # rubocop:disable Style/FormatStringToken
|
|
281
285
|
else
|
|
282
|
-
'%s-%04d-%s' % [version, build, sha]
|
|
283
|
-
|
|
286
|
+
'%s-%04d-%s' % [version, build, sha] # legacy support code # rubocop:disable Style/FormatStringToken
|
|
287
|
+
end
|
|
284
288
|
else
|
|
285
289
|
"#{version}-#{sha}"
|
|
286
290
|
end
|
|
@@ -297,10 +301,7 @@ task :release_checks do
|
|
|
297
301
|
else
|
|
298
302
|
Rake::Task[:spec].invoke
|
|
299
303
|
end
|
|
300
|
-
Rake::Task[
|
|
301
|
-
Rake::Task['check:test_file'].invoke
|
|
302
|
-
Rake::Task['check:dot_underscore'].invoke
|
|
303
|
-
Rake::Task['check:git_ignore'].invoke
|
|
304
|
+
Rake::Task[:check].invoke
|
|
304
305
|
end
|
|
305
306
|
|
|
306
307
|
namespace :check do
|
|
@@ -341,6 +342,9 @@ namespace :check do
|
|
|
341
342
|
end
|
|
342
343
|
end
|
|
343
344
|
|
|
345
|
+
desc 'Run static pre release checks'
|
|
346
|
+
task check: ['check:symlinks', 'check:test_file', 'check:dot_underscore', 'check:git_ignore']
|
|
347
|
+
|
|
344
348
|
desc 'Display the list of available rake tasks'
|
|
345
349
|
task :help do
|
|
346
350
|
system('rake -T')
|
|
@@ -389,6 +393,7 @@ def create_gch_task(changelog_user = nil, changelog_project = nil, changelog_sin
|
|
|
389
393
|
def changelog_user_from_metadata
|
|
390
394
|
result = JSON.parse(File.read('metadata.json'))['author']
|
|
391
395
|
raise 'unable to find the changelog_user in .sync.yml, or the author in metadata.json' if result.nil?
|
|
396
|
+
|
|
392
397
|
puts "GitHubChangelogGenerator user:#{result}"
|
|
393
398
|
result
|
|
394
399
|
end
|
|
@@ -396,14 +401,17 @@ def create_gch_task(changelog_user = nil, changelog_project = nil, changelog_sin
|
|
|
396
401
|
def changelog_project_from_metadata
|
|
397
402
|
result = JSON.parse(File.read('metadata.json'))['name']
|
|
398
403
|
raise 'unable to find the changelog_project in .sync.yml or the name in metadata.json' if result.nil?
|
|
404
|
+
|
|
399
405
|
puts "GitHubChangelogGenerator project:#{result}"
|
|
400
406
|
result
|
|
401
407
|
end
|
|
402
408
|
|
|
403
409
|
def changelog_future_release
|
|
404
410
|
return unless Rake.application.top_level_tasks.include? 'changelog'
|
|
411
|
+
|
|
405
412
|
result = JSON.parse(File.read('metadata.json'))['version']
|
|
406
413
|
raise 'unable to find the future_release (version) in metadata.json' if result.nil?
|
|
414
|
+
|
|
407
415
|
puts "GitHubChangelogGenerator future_release:#{result}"
|
|
408
416
|
result
|
|
409
417
|
end
|
|
@@ -413,6 +421,7 @@ def create_gch_task(changelog_user = nil, changelog_project = nil, changelog_sin
|
|
|
413
421
|
if ENV['CHANGELOG_GITHUB_TOKEN'].nil?
|
|
414
422
|
raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'"
|
|
415
423
|
end
|
|
424
|
+
|
|
416
425
|
config.user = changelog_user || changelog_user_from_metadata
|
|
417
426
|
config.project = changelog_project || changelog_project_from_metadata
|
|
418
427
|
config.since_tag = changelog_since_tag if changelog_since_tag
|
|
@@ -442,7 +451,7 @@ def create_gch_task(changelog_user = nil, changelog_project = nil, changelog_sin
|
|
|
442
451
|
else
|
|
443
452
|
desc 'Generate a Changelog from GitHub'
|
|
444
453
|
task :changelog do
|
|
445
|
-
raise <<
|
|
454
|
+
raise <<MESSAGE
|
|
446
455
|
The changelog tasks depends on unreleased features of the github_changelog_generator gem.
|
|
447
456
|
Please manually add it to your .sync.yml for now, and run `pdk update`:
|
|
448
457
|
---
|
|
@@ -453,7 +462,7 @@ Gemfile:
|
|
|
453
462
|
git: 'https://github.com/skywinder/github-changelog-generator'
|
|
454
463
|
ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
|
|
455
464
|
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"
|
|
456
|
-
|
|
465
|
+
MESSAGE
|
|
457
466
|
end
|
|
458
467
|
end
|
|
459
468
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'rspec/core/rake_task'
|
|
2
4
|
|
|
3
5
|
module PuppetlabsSpecHelper; end
|
|
@@ -10,9 +12,7 @@ module PuppetlabsSpecHelper::Tasks::BeakerHelpers
|
|
|
10
12
|
|
|
11
13
|
# cache the repositories and return a hash object
|
|
12
14
|
def repositories
|
|
13
|
-
|
|
14
|
-
@repositories = fixtures('repositories')
|
|
15
|
-
end
|
|
15
|
+
@repositories ||= fixtures('repositories')
|
|
16
16
|
@repositories
|
|
17
17
|
end
|
|
18
18
|
|
|
@@ -20,6 +20,7 @@ module PuppetlabsSpecHelper::Tasks::BeakerHelpers
|
|
|
20
20
|
# @return [Array<String>]
|
|
21
21
|
def beaker_node_sets
|
|
22
22
|
return @beaker_nodes if @beaker_nodes
|
|
23
|
+
|
|
23
24
|
@beaker_nodes = Dir['spec/acceptance/nodesets/*.yml'].sort.map do |node_set|
|
|
24
25
|
node_set.slice!('.yml')
|
|
25
26
|
File.basename(node_set)
|
|
@@ -50,7 +51,7 @@ module PuppetlabsSpecHelper::Tasks::BeakerHelpers
|
|
|
50
51
|
end
|
|
51
52
|
end
|
|
52
53
|
end
|
|
53
|
-
include PuppetlabsSpecHelper::Tasks::BeakerHelpers
|
|
54
|
+
include PuppetlabsSpecHelper::Tasks::BeakerHelpers # legacy support code # rubocop:disable Style/MixinUsage
|
|
54
55
|
|
|
55
56
|
desc 'Run beaker acceptance tests'
|
|
56
57
|
RSpec::Core::RakeTask.new(:beaker) do |t|
|
|
@@ -58,24 +59,26 @@ RSpec::Core::RakeTask.new(:beaker) do |t|
|
|
|
58
59
|
end
|
|
59
60
|
|
|
60
61
|
class SetupBeaker
|
|
61
|
-
def self.setup_beaker(
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
def self.setup_beaker(task)
|
|
63
|
+
task.rspec_opts = []
|
|
64
|
+
task.pattern = 'spec/acceptance'
|
|
64
65
|
# TEST_TIERS env variable is a comma separated list of tiers to run. e.g. low, medium, high
|
|
65
66
|
if ENV['TEST_TIERS']
|
|
66
67
|
test_tiers = ENV['TEST_TIERS'].split(',')
|
|
67
68
|
test_tiers_allowed = ENV.fetch('TEST_TIERS_ALLOWED', 'low,medium,high').split(',')
|
|
68
69
|
raise 'TEST_TIERS env variable must have at least 1 tier specified. Either low, medium or high or one of the tiers listed in TEST_TIERS_ALLOWED (comma separated).' if test_tiers.count == 0
|
|
70
|
+
|
|
69
71
|
test_tiers.each do |tier|
|
|
70
72
|
tier_to_add = tier.strip.downcase
|
|
71
73
|
raise "#{tier_to_add} not a valid test tier." unless test_tiers_allowed.include?(tier_to_add)
|
|
74
|
+
|
|
72
75
|
tiers = "--tag tier_#{tier_to_add}"
|
|
73
|
-
|
|
76
|
+
task.rspec_opts.push(tiers)
|
|
74
77
|
end
|
|
75
78
|
else
|
|
76
79
|
puts 'TEST_TIERS env variable not defined. Defaulting to run all tests.'
|
|
77
80
|
end
|
|
78
|
-
|
|
81
|
+
task
|
|
79
82
|
end
|
|
80
83
|
end
|
|
81
84
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'pathspec'
|
|
2
4
|
|
|
3
5
|
module PuppetlabsSpecHelper; end
|
|
@@ -33,7 +35,7 @@ class PuppetlabsSpecHelper::Tasks::CheckSymlinks
|
|
|
33
35
|
end
|
|
34
36
|
|
|
35
37
|
def ignored?(path)
|
|
36
|
-
path = path
|
|
38
|
+
path = "#{path}/" if File.directory?(path)
|
|
37
39
|
|
|
38
40
|
!ignore_pathspec.match_paths([path], Dir.pwd).empty?
|
|
39
41
|
end
|
|
@@ -42,6 +44,7 @@ class PuppetlabsSpecHelper::Tasks::CheckSymlinks
|
|
|
42
44
|
@ignore_pathspec ||= PathSpec.new(DEFAULT_IGNORED).tap do |pathspec|
|
|
43
45
|
IGNORE_LIST_FILES.each do |f|
|
|
44
46
|
next unless File.file?(f) && File.readable?(f)
|
|
47
|
+
|
|
45
48
|
File.open(f, 'r') { |fd| pathspec.add(fd) }
|
|
46
49
|
end
|
|
47
50
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'yaml'
|
|
2
4
|
require 'open3'
|
|
3
5
|
require 'json'
|
|
@@ -25,6 +27,17 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
|
25
27
|
File.basename(Dir.pwd).split('-').last
|
|
26
28
|
end
|
|
27
29
|
|
|
30
|
+
def module_version(path)
|
|
31
|
+
metadata_path = File.join(path, 'metadata.json')
|
|
32
|
+
raise ArgumentError unless File.file?(metadata_path) && File.readable?(metadata_path)
|
|
33
|
+
|
|
34
|
+
metadata = JSON.parse(File.read(metadata_path))
|
|
35
|
+
metadata.fetch('version', nil) || '0.0.1'
|
|
36
|
+
rescue JSON::ParserError, ArgumentError
|
|
37
|
+
logger.warn "Failed to find module version at path #{path}"
|
|
38
|
+
'0.0.1'
|
|
39
|
+
end
|
|
40
|
+
|
|
28
41
|
# @return [Hash] - returns a hash of all the fixture repositories
|
|
29
42
|
# @example
|
|
30
43
|
# {"puppetlabs-stdlib"=>{"target"=>"https://gitlab.com/puppetlabs/puppet-stdlib.git",
|
|
@@ -50,7 +63,7 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
|
50
63
|
|
|
51
64
|
# @return [Hash] - returns a hash with the module name and the source directory
|
|
52
65
|
def auto_symlink
|
|
53
|
-
{ module_name =>
|
|
66
|
+
{ module_name => "\#{source_dir}" }
|
|
54
67
|
end
|
|
55
68
|
|
|
56
69
|
# @return [Boolean] - true if the os is a windows system
|
|
@@ -116,21 +129,22 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
|
116
129
|
end
|
|
117
130
|
# there should be a warning or something if it's not a hash...
|
|
118
131
|
next unless opts.instance_of?(Hash)
|
|
132
|
+
|
|
119
133
|
# merge our options into the defaults to get the
|
|
120
134
|
# final option list
|
|
121
135
|
opts = defaults.merge(opts)
|
|
122
136
|
|
|
123
137
|
next unless include_repo?(opts['puppet_version'])
|
|
124
138
|
|
|
125
|
-
real_target = eval(
|
|
126
|
-
real_source = eval(
|
|
139
|
+
real_target = eval("\"#{opts['target']}\"", binding, __FILE__, __LINE__) # evaluating target reference in this context (see auto_symlink)
|
|
140
|
+
real_source = eval("\"#{opts['repo']}\"", binding, __FILE__, __LINE__) # evaluating repo reference in this context (see auto_symlink)
|
|
127
141
|
|
|
128
142
|
result[real_source] = validate_fixture_hash!(
|
|
129
143
|
'target' => File.join(real_target, fixture),
|
|
130
|
-
'ref'
|
|
144
|
+
'ref' => opts['ref'] || opts['tag'],
|
|
131
145
|
'branch' => opts['branch'],
|
|
132
|
-
'scm'
|
|
133
|
-
'flags'
|
|
146
|
+
'scm' => opts['scm'],
|
|
147
|
+
'flags' => opts['flags'],
|
|
134
148
|
'subdir' => opts['subdir'],
|
|
135
149
|
)
|
|
136
150
|
end
|
|
@@ -143,7 +157,7 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
|
143
157
|
return hash unless hash['scm'] == 'git'
|
|
144
158
|
|
|
145
159
|
# Forward slashes in the ref aren't allowed. And is probably a branch name.
|
|
146
|
-
raise ArgumentError, "The ref for #{hash['target']} is invalid (Contains a forward slash). If this is a branch name, please use the 'branch' setting instead." if hash['ref'] =~ %r{
|
|
160
|
+
raise ArgumentError, "The ref for #{hash['target']} is invalid (Contains a forward slash). If this is a branch name, please use the 'branch' setting instead." if hash['ref'] =~ %r{/}
|
|
147
161
|
|
|
148
162
|
hash
|
|
149
163
|
end
|
|
@@ -181,6 +195,7 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
|
181
195
|
unless File.exist?(target)
|
|
182
196
|
raise "Failed to clone #{scm} repository #{remote} into #{target}"
|
|
183
197
|
end
|
|
198
|
+
|
|
184
199
|
result
|
|
185
200
|
end
|
|
186
201
|
|
|
@@ -228,7 +243,7 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
|
228
243
|
end
|
|
229
244
|
|
|
230
245
|
def git_remote_url(target)
|
|
231
|
-
output, status = Open3.capture2e('git', '-
|
|
246
|
+
output, status = Open3.capture2e('git', '--git-dir', File.join(target, '.git'), 'ls-remote', '--get-url', 'origin')
|
|
232
247
|
status.success? ? output.strip : nil
|
|
233
248
|
end
|
|
234
249
|
|
|
@@ -251,7 +266,7 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
|
251
266
|
else
|
|
252
267
|
Logger::INFO
|
|
253
268
|
end
|
|
254
|
-
@logger = Logger.new(
|
|
269
|
+
@logger = Logger.new($stderr)
|
|
255
270
|
@logger.level = level
|
|
256
271
|
end
|
|
257
272
|
@logger
|
|
@@ -261,7 +276,7 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
|
261
276
|
# The problem with the relative path is that PMT doesn't expand the path properly and so passing in a relative path here
|
|
262
277
|
# becomes something like C:\somewhere\backslashes/spec/fixtures/work-dir on Windows, and then PMT barfs itself.
|
|
263
278
|
# This has been reported as https://tickets.puppetlabs.com/browse/PUP-4884
|
|
264
|
-
File.expand_path(
|
|
279
|
+
File.expand_path(ENV['MODULE_WORKING_DIR'] || 'spec/fixtures/work-dir')
|
|
265
280
|
end
|
|
266
281
|
|
|
267
282
|
# returns the current thread count that is currently active
|
|
@@ -318,6 +333,7 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
|
318
333
|
def setup_symlink(target, link)
|
|
319
334
|
link = link['target']
|
|
320
335
|
return if File.symlink?(link)
|
|
336
|
+
|
|
321
337
|
logger.info("Creating symlink from #{link} to #{target}")
|
|
322
338
|
if windows?
|
|
323
339
|
target = File.join(File.dirname(link), target) unless Pathname.new(target).absolute?
|
|
@@ -370,13 +386,13 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
|
370
386
|
flags = " #{opts['flags']}" if opts['flags']
|
|
371
387
|
end
|
|
372
388
|
|
|
373
|
-
return false if File.directory?(target)
|
|
389
|
+
return false if File.directory?(target) && (ref.empty? || opts['ref'] == module_version(target))
|
|
374
390
|
|
|
375
391
|
# The PMT cannot handle multi threaded runs due to cache directory collisons
|
|
376
392
|
# so we randomize the directory instead.
|
|
377
393
|
# Does working_dir even need to be passed?
|
|
378
394
|
Dir.mktmpdir do |working_dir|
|
|
379
|
-
command =
|
|
395
|
+
command = "puppet module install#{ref}#{flags} --ignore-dependencies" \
|
|
380
396
|
' --force' \
|
|
381
397
|
" --module_working_dir \"#{working_dir}\"" \
|
|
382
398
|
" --target-dir \"#{module_target_dir}\" \"#{remote}\""
|
|
@@ -389,7 +405,7 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
|
389
405
|
end
|
|
390
406
|
end
|
|
391
407
|
|
|
392
|
-
include PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
408
|
+
include PuppetlabsSpecHelper::Tasks::FixtureHelpers # DSL include # rubocop:disable Style/MixinUsage
|
|
393
409
|
|
|
394
410
|
desc 'Create the fixtures directory'
|
|
395
411
|
task :spec_prep do
|
|
@@ -399,7 +415,7 @@ task :spec_prep do
|
|
|
399
415
|
begin
|
|
400
416
|
require 'win32/dir'
|
|
401
417
|
rescue LoadError
|
|
402
|
-
|
|
418
|
+
warn 'win32-dir gem not installed, falling back to executing mklink directly'
|
|
403
419
|
end
|
|
404
420
|
end
|
|
405
421
|
|
data/puppet_spec_helper.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
lib = File.expand_path('
|
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
require 'puppetlabs_spec_helper/version'
|
|
6
6
|
|
|
@@ -21,17 +21,17 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
spec.require_paths = ['lib']
|
|
22
22
|
|
|
23
23
|
spec.add_runtime_dependency 'mocha', '~> 1.0'
|
|
24
|
+
spec.add_runtime_dependency 'pathspec', '>= 0.2.1', '< 1.1.0'
|
|
24
25
|
spec.add_runtime_dependency 'puppet-lint', '~> 2.0'
|
|
25
26
|
spec.add_runtime_dependency 'puppet-syntax', ['>= 2.0', '< 4']
|
|
26
27
|
spec.add_runtime_dependency 'rspec-puppet', '~> 2.0'
|
|
27
|
-
spec.add_runtime_dependency 'pathspec', '~> 0.2.1'
|
|
28
28
|
|
|
29
29
|
spec.add_development_dependency 'bundler'
|
|
30
|
+
spec.add_development_dependency 'fakefs', ['>= 0.13.3', '< 2']
|
|
31
|
+
spec.add_development_dependency 'gettext-setup', '~> 0.29'
|
|
30
32
|
spec.add_development_dependency 'pry'
|
|
31
33
|
spec.add_development_dependency 'puppet'
|
|
32
34
|
spec.add_development_dependency 'rake', ['>= 10.0', '< 14']
|
|
33
35
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
34
36
|
spec.add_development_dependency 'yard'
|
|
35
|
-
spec.add_development_dependency 'gettext-setup', '~> 0.29'
|
|
36
|
-
spec.add_development_dependency 'fakefs', ['>= 0.13.3', '< 2']
|
|
37
37
|
end
|
data/puppetlabs_spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: puppetlabs_spec_helper
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.16.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Puppet, Inc.
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2021-01-18 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: mocha
|
|
@@ -25,6 +25,26 @@ dependencies:
|
|
|
25
25
|
- - "~>"
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
27
|
version: '1.0'
|
|
28
|
+
- !ruby/object:Gem::Dependency
|
|
29
|
+
name: pathspec
|
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
|
31
|
+
requirements:
|
|
32
|
+
- - ">="
|
|
33
|
+
- !ruby/object:Gem::Version
|
|
34
|
+
version: 0.2.1
|
|
35
|
+
- - "<"
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: 1.1.0
|
|
38
|
+
type: :runtime
|
|
39
|
+
prerelease: false
|
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
+
requirements:
|
|
42
|
+
- - ">="
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
version: 0.2.1
|
|
45
|
+
- - "<"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 1.1.0
|
|
28
48
|
- !ruby/object:Gem::Dependency
|
|
29
49
|
name: puppet-lint
|
|
30
50
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -74,33 +94,53 @@ dependencies:
|
|
|
74
94
|
- !ruby/object:Gem::Version
|
|
75
95
|
version: '2.0'
|
|
76
96
|
- !ruby/object:Gem::Dependency
|
|
77
|
-
name:
|
|
97
|
+
name: bundler
|
|
78
98
|
requirement: !ruby/object:Gem::Requirement
|
|
79
99
|
requirements:
|
|
80
|
-
- - "
|
|
100
|
+
- - ">="
|
|
81
101
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: 0
|
|
83
|
-
type: :
|
|
102
|
+
version: '0'
|
|
103
|
+
type: :development
|
|
84
104
|
prerelease: false
|
|
85
105
|
version_requirements: !ruby/object:Gem::Requirement
|
|
86
106
|
requirements:
|
|
87
|
-
- - "
|
|
107
|
+
- - ">="
|
|
88
108
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: 0
|
|
109
|
+
version: '0'
|
|
90
110
|
- !ruby/object:Gem::Dependency
|
|
91
|
-
name:
|
|
111
|
+
name: fakefs
|
|
92
112
|
requirement: !ruby/object:Gem::Requirement
|
|
93
113
|
requirements:
|
|
94
114
|
- - ">="
|
|
95
115
|
- !ruby/object:Gem::Version
|
|
96
|
-
version:
|
|
116
|
+
version: 0.13.3
|
|
117
|
+
- - "<"
|
|
118
|
+
- !ruby/object:Gem::Version
|
|
119
|
+
version: '2'
|
|
97
120
|
type: :development
|
|
98
121
|
prerelease: false
|
|
99
122
|
version_requirements: !ruby/object:Gem::Requirement
|
|
100
123
|
requirements:
|
|
101
124
|
- - ">="
|
|
102
125
|
- !ruby/object:Gem::Version
|
|
103
|
-
version:
|
|
126
|
+
version: 0.13.3
|
|
127
|
+
- - "<"
|
|
128
|
+
- !ruby/object:Gem::Version
|
|
129
|
+
version: '2'
|
|
130
|
+
- !ruby/object:Gem::Dependency
|
|
131
|
+
name: gettext-setup
|
|
132
|
+
requirement: !ruby/object:Gem::Requirement
|
|
133
|
+
requirements:
|
|
134
|
+
- - "~>"
|
|
135
|
+
- !ruby/object:Gem::Version
|
|
136
|
+
version: '0.29'
|
|
137
|
+
type: :development
|
|
138
|
+
prerelease: false
|
|
139
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
140
|
+
requirements:
|
|
141
|
+
- - "~>"
|
|
142
|
+
- !ruby/object:Gem::Version
|
|
143
|
+
version: '0.29'
|
|
104
144
|
- !ruby/object:Gem::Dependency
|
|
105
145
|
name: pry
|
|
106
146
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -177,40 +217,6 @@ dependencies:
|
|
|
177
217
|
- - ">="
|
|
178
218
|
- !ruby/object:Gem::Version
|
|
179
219
|
version: '0'
|
|
180
|
-
- !ruby/object:Gem::Dependency
|
|
181
|
-
name: gettext-setup
|
|
182
|
-
requirement: !ruby/object:Gem::Requirement
|
|
183
|
-
requirements:
|
|
184
|
-
- - "~>"
|
|
185
|
-
- !ruby/object:Gem::Version
|
|
186
|
-
version: '0.29'
|
|
187
|
-
type: :development
|
|
188
|
-
prerelease: false
|
|
189
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
190
|
-
requirements:
|
|
191
|
-
- - "~>"
|
|
192
|
-
- !ruby/object:Gem::Version
|
|
193
|
-
version: '0.29'
|
|
194
|
-
- !ruby/object:Gem::Dependency
|
|
195
|
-
name: fakefs
|
|
196
|
-
requirement: !ruby/object:Gem::Requirement
|
|
197
|
-
requirements:
|
|
198
|
-
- - ">="
|
|
199
|
-
- !ruby/object:Gem::Version
|
|
200
|
-
version: 0.13.3
|
|
201
|
-
- - "<"
|
|
202
|
-
- !ruby/object:Gem::Version
|
|
203
|
-
version: '2'
|
|
204
|
-
type: :development
|
|
205
|
-
prerelease: false
|
|
206
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
207
|
-
requirements:
|
|
208
|
-
- - ">="
|
|
209
|
-
- !ruby/object:Gem::Version
|
|
210
|
-
version: 0.13.3
|
|
211
|
-
- - "<"
|
|
212
|
-
- !ruby/object:Gem::Version
|
|
213
|
-
version: '2'
|
|
214
220
|
description: Contains rake tasks and a standard spec_helper for running spec tests
|
|
215
221
|
on puppet modules.
|
|
216
222
|
email:
|
|
@@ -267,8 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
267
273
|
- !ruby/object:Gem::Version
|
|
268
274
|
version: '0'
|
|
269
275
|
requirements: []
|
|
270
|
-
|
|
271
|
-
rubygems_version: 2.7.8
|
|
276
|
+
rubygems_version: 3.2.5
|
|
272
277
|
signing_key:
|
|
273
278
|
specification_version: 4
|
|
274
279
|
summary: Standard tasks and configuration for module spec tests.
|