puppetlabs_spec_helper 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
2014-07-17 - Release 0.7.0
|
2
|
+
Summary:
|
3
|
+
This feature release adds the ability to test structured facts, manifest
|
4
|
+
ordering, and trusted node facts, and check out branches with fixtures.
|
5
|
+
|
6
|
+
Features:
|
7
|
+
- Add `STRINGIFY_FACTS=no` for structured facts
|
8
|
+
- Add `TRUSTED_NODE_DATA=yes` for trusted node data
|
9
|
+
- Add `ORDERING=<order>` for manifest ordering
|
10
|
+
- Add `:branch` support for fixtures on a branch.
|
11
|
+
|
12
|
+
Bugfixes:
|
13
|
+
- Fix puppet-lint to ignore spec/fixtures/
|
14
|
+
|
1
15
|
2014-07-02 - Release 0.6.0
|
2
16
|
Summary:
|
3
17
|
This feature release adds the `validate` rake task and the ability to test
|
data/README.markdown
CHANGED
@@ -94,11 +94,33 @@ NOTE that this is specifically for initializing Puppet's core. If your project
|
|
94
94
|
not have any dependencies on puppet and you just want to use the utility classes,
|
95
95
|
see the next section.
|
96
96
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
97
|
+
A number of the Puppet parser features, controlled via configuration during a
|
98
|
+
normal puppet run, can be controlled by exporting specific environment
|
99
|
+
variables for the spec run. These are:
|
100
|
+
|
101
|
+
* ``FUTURE_PARSER`` - set to "yes" to enable the [future parser](http://docs.puppetlabs.com/puppet/latest/reference/experiments_future.html),
|
102
|
+
the equivalent of setting [parser=future](http://docs.puppetlabs.com/references/latest/configuration.html#parser)
|
103
|
+
in puppet.conf.
|
104
|
+
* ``STRICT_VARIABLES`` - set to "yes" to enable strict variable checking,
|
105
|
+
the equivalent of setting [strict_variables](http://docs.puppetlabs.com/references/latest/configuration.html#strictvariables)=true
|
106
|
+
in puppet.conf.
|
107
|
+
* ``ORDERING`` - set to the desired ordering method ("title-hash", "manifest", or "random")
|
108
|
+
to set the order of unrelated resources when applying a catalog. Leave unset for the default
|
109
|
+
behavior, currently "random". This is equivalent to setting [ordering](http://docs.puppetlabs.com/references/latest/configuration.html#ordering)
|
110
|
+
in puppet.conf.
|
111
|
+
* ``STRINGIFY_FACTS`` - set to "no" to enable [structured facts](http://docs.puppetlabs.com/facter/2.0/fact_overview.html#writing-structured-facts),
|
112
|
+
otherwise leave unset to retain the current default behavior. This is equivalent to setting
|
113
|
+
[stringify_facts=false](http://docs.puppetlabs.com/references/latest/configuration.html#stringifyfacts)
|
114
|
+
in puppet.conf.
|
115
|
+
* ``TRUSTED_NODE_DATA`` - set to "yes" to enable [the $facts hash and trusted node data](http://docs.puppetlabs.com/puppet/latest/reference/lang_facts_and_builtin_vars.html),
|
116
|
+
which enabled ``$facts`` and ``$trusted`` hashes. This is equivalent to setting
|
117
|
+
[trusted_node_data=true](http://docs.puppetlabs.com/references/latest/configuration.html#trustednodedata)
|
118
|
+
in puppet.conf.
|
119
|
+
|
120
|
+
As an example, to run spec tests with the future parser, strict variable checking,
|
121
|
+
and manifest ordering, you would:
|
122
|
+
|
123
|
+
FUTURE_PARSER=yes STRICT_VARIABLES=yes ORDERING=manifest rake spec
|
102
124
|
|
103
125
|
Using Utility Classes
|
104
126
|
=====================
|
@@ -24,9 +24,16 @@ RSpec.configure do |c|
|
|
24
24
|
## These depend on rspec-puppet #209 and #183 being released
|
25
25
|
#c.parser = 'future' if ENV['FUTURE_PARSER'] == 'yes'
|
26
26
|
#c.strict_variables = true if ENV['STRICT_VARIABLES'] == 'yes'
|
27
|
+
## These depend on rspec-puppet #212 being released
|
28
|
+
#c.stringify_facts = false if ENV['STRINGIFY_FACTS'] == 'no'
|
29
|
+
#c.trusted_node_data = true if ENV['TRUSTED_NODE_DATA'] == 'yes'
|
30
|
+
#c.ordering = ENV['ORDERING'] if ENV['ORDERING']
|
27
31
|
|
28
32
|
c.before :each do
|
29
33
|
Puppet.settings[:strict_variables] = true if ENV['STRICT_VARIABLES'] == 'yes'
|
30
34
|
Puppet.settings[:parser] = 'future' if ENV['FUTURE_PARSER'] == 'yes'
|
35
|
+
Puppet.settings[:stringify_facts] = false if ENV['STRINGIFY_FACTS'] == 'no'
|
36
|
+
Puppet.settings[:trusted_node_data] = true if ENV['TRUSTED_NODE_DATA'] == 'yes'
|
37
|
+
Puppet.settings[:ordering] = ENV['ORDERING'] if ENV['ORDERING']
|
31
38
|
end
|
32
39
|
end
|
@@ -49,14 +49,14 @@ def fixtures(category)
|
|
49
49
|
elsif opts.instance_of?(Hash)
|
50
50
|
target = "spec/fixtures/modules/#{fixture}"
|
51
51
|
real_source = eval('"'+opts["repo"]+'"')
|
52
|
-
result[real_source] = { "target" => target, "ref" => opts["ref"], "scm" => opts["scm"] }
|
52
|
+
result[real_source] = { "target" => target, "ref" => opts["ref"], "branch" => opts["branch"], "scm" => opts["scm"] }
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
56
56
|
return result
|
57
57
|
end
|
58
58
|
|
59
|
-
def clone_repo(scm, remote, target, ref=nil)
|
59
|
+
def clone_repo(scm, remote, target, ref=nil, branch=nil)
|
60
60
|
args = []
|
61
61
|
case scm
|
62
62
|
when 'hg'
|
@@ -64,7 +64,9 @@ def clone_repo(scm, remote, target, ref=nil)
|
|
64
64
|
args.push('-u', ref) if ref
|
65
65
|
args.push(remote, target)
|
66
66
|
when 'git'
|
67
|
-
args.push('clone'
|
67
|
+
args.push('clone')
|
68
|
+
args.push('-b', branch) if branch
|
69
|
+
args.push(remote, target)
|
68
70
|
else
|
69
71
|
fail "Unfortunately #{scm} is not supported yet"
|
70
72
|
end
|
@@ -94,9 +96,10 @@ task :spec_prep do
|
|
94
96
|
target = opts["target"]
|
95
97
|
ref = opts["ref"]
|
96
98
|
scm = opts["scm"] if opts["scm"]
|
99
|
+
branch = opts["branch"] if opts["branch"]
|
97
100
|
end
|
98
101
|
|
99
|
-
unless File::exists?(target) || clone_repo(scm, remote, target, ref)
|
102
|
+
unless File::exists?(target) || clone_repo(scm, remote, target, ref, branch)
|
100
103
|
fail "Failed to clone #{scm} repository #{remote} into #{target}"
|
101
104
|
end
|
102
105
|
revision(scm, target, ref) if ref
|
@@ -193,7 +196,8 @@ end
|
|
193
196
|
desc "Check puppet manifests with puppet-lint"
|
194
197
|
task :lint do
|
195
198
|
require 'puppet-lint/tasks/puppet-lint'
|
196
|
-
PuppetLint.configuration.ignore_paths
|
199
|
+
PuppetLint.configuration.ignore_paths ||= []
|
200
|
+
PuppetLint.configuration.ignore_paths << "spec/fixtures/**/*.pp"
|
197
201
|
end
|
198
202
|
|
199
203
|
desc "Check puppet manifest syntax"
|
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: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-07-
|
12
|
+
date: 2014-07-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|