rspec-system-puppet 1.0.2 → 1.1.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.
- data/README.md +2 -2
- data/lib/rspec-system-puppet/helpers.rb +13 -10
- data/rspec-system-puppet.gemspec +2 -2
- data/spec/system/basic_spec.rb +25 -25
- metadata +13 -5
data/README.md
CHANGED
@@ -128,14 +128,14 @@ And create your first system tests in say `spec/system/basic_spec.rb` (make sure
|
|
128
128
|
it 'my class should work with no errors' do
|
129
129
|
# Run it once and make sure it doesn't bail with errors
|
130
130
|
puppet_apply(pp) do |r|
|
131
|
-
r
|
131
|
+
r.exit_code.should_not eq(1)
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
135
|
it 'my class should be idempotent' do
|
136
136
|
# Run it again and make sure no changes occurred this time, proving idempotency
|
137
137
|
puppet_apply(pp) do |r|
|
138
|
-
r
|
138
|
+
r.exit_code.should == 0
|
139
139
|
end
|
140
140
|
end
|
141
141
|
end
|
@@ -98,16 +98,16 @@ host { 'puppet':
|
|
98
98
|
# @option opts [RSpecSystem::Node] :node node to execute DSL on
|
99
99
|
# @option opts [Boolean] :debug true if debugging required
|
100
100
|
# @option opts [Boolean] :trace true if trace required
|
101
|
-
# @return [
|
101
|
+
# @return [RSpecSystem::Result] results containing keys :exit_code, :stdout and :stderr
|
102
102
|
# @yield [result] yields result when called as a block
|
103
|
-
# @yieldparam result [
|
103
|
+
# @yieldparam result [RSpecSystem::Result] a hash containing :exit_code, :stdout and :stderr
|
104
104
|
# @example
|
105
105
|
# puppet_agent.do |r|
|
106
|
-
# r
|
106
|
+
# r.exit_code.should == 0
|
107
107
|
# end
|
108
108
|
# @example with debugging enabled
|
109
109
|
# puppet_agent(:debug => true).do |r|
|
110
|
-
# r
|
110
|
+
# r.exit_code.should == 0
|
111
111
|
# end
|
112
112
|
def puppet_agent(opts = {})
|
113
113
|
# Defaults etc.
|
@@ -155,6 +155,9 @@ host { 'puppet':
|
|
155
155
|
# Runs puppet resource commands
|
156
156
|
#
|
157
157
|
# @param opts [Hash] a hash of opts
|
158
|
+
# @return [RSpecSystem::Result] results containing keys :exit_code, :stdout and :stderr
|
159
|
+
# @yield [result] yields result when called as a block
|
160
|
+
# @yieldparam result [RSpecSystem::Result] a hash containing :exit_code, :stdout and :stderr
|
158
161
|
def puppet_resource(opts)
|
159
162
|
if opts.is_a?(String)
|
160
163
|
opts = {:resource => opts}
|
@@ -191,13 +194,13 @@ host { 'puppet':
|
|
191
194
|
# @option opts [RSpecSystem::Node] :node node to execute DSL on
|
192
195
|
# @option opts [Boolean] :debug true if debugging required
|
193
196
|
# @option opts [Boolean] :trace true if trace required
|
194
|
-
# @return [
|
197
|
+
# @return [RSpecSystem::Result] results containing keys :exit_code, :stdout and :stderr
|
195
198
|
# @yield [result] yields result when called as a block
|
196
|
-
# @yieldparam result [
|
199
|
+
# @yieldparam result [RSpecSystem::Result] a hash containing :exit_code, :stdout and :stderr
|
197
200
|
# @example
|
198
201
|
# it "run notice" do
|
199
202
|
# puppet_apply("notice('foo')") do |r|
|
200
|
-
# r
|
203
|
+
# r.stdout.should =~ /foo/
|
201
204
|
# end
|
202
205
|
# end
|
203
206
|
def puppet_apply(opts)
|
@@ -247,9 +250,9 @@ host { 'puppet':
|
|
247
250
|
#
|
248
251
|
# @param opts [Hash] a hash of opts
|
249
252
|
# @option opts [RSpecSystem::Node] :node node to execute DSL on
|
250
|
-
# @return [
|
253
|
+
# @return [RSpecSystem::Result] a hash of results
|
251
254
|
# @yield [result] yields result when called as a block
|
252
|
-
# @yieldparam result [
|
255
|
+
# @yieldparam result [RSpecSystem::Result] result containing :facts, :exit_code, :stdout and
|
253
256
|
# :stderr
|
254
257
|
def facter(opts = {})
|
255
258
|
# Defaults
|
@@ -266,7 +269,7 @@ host { 'puppet':
|
|
266
269
|
|
267
270
|
begin
|
268
271
|
facts = YAML::load(result[:stdout])
|
269
|
-
result
|
272
|
+
result.facts = facts
|
270
273
|
rescue
|
271
274
|
end
|
272
275
|
|
data/rspec-system-puppet.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
# Metadata
|
4
4
|
s.name = "rspec-system-puppet"
|
5
|
-
s.version = "1.0
|
5
|
+
s.version = "1.1.0"
|
6
6
|
s.authors = ["Ken Barber"]
|
7
7
|
s.email = ["ken@bob.sh"]
|
8
8
|
s.homepage = "https://github.com/puppetlabs/rspec-system-puppet"
|
@@ -16,5 +16,5 @@ Gem::Specification.new do |s|
|
|
16
16
|
|
17
17
|
# Dependencies
|
18
18
|
s.required_ruby_version = '>= 1.8.7'
|
19
|
-
s.add_runtime_dependency "rspec-system", '~> 1.0'
|
19
|
+
s.add_runtime_dependency "rspec-system", '~> 1.2', '>= 1.2.0'
|
20
20
|
end
|
data/spec/system/basic_spec.rb
CHANGED
@@ -9,63 +9,63 @@ describe "basic tests:" do
|
|
9
9
|
puppet_master_install()
|
10
10
|
|
11
11
|
puppet_agent do |r|
|
12
|
-
r
|
13
|
-
r
|
12
|
+
r.stderr.should == ''
|
13
|
+
r.exit_code.should == 0
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'try puppet agent with debug enabled' do
|
18
18
|
puppet_agent(:debug => true) do |r|
|
19
|
-
r
|
20
|
-
r
|
21
|
-
r
|
19
|
+
r.stderr.should == ''
|
20
|
+
r.stdout.should =~ /Debug:/
|
21
|
+
r.exit_code.should == 0
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'facter domain should return something valid' do
|
26
26
|
facter do |r|
|
27
|
-
r
|
28
|
-
r
|
27
|
+
r.facts['domain'].should =~ /[a-z]+/
|
28
|
+
r.exit_code.should == 0
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'facter fqdn should return something valid' do
|
33
33
|
facter do |r|
|
34
|
-
r
|
35
|
-
r
|
36
|
-
r
|
34
|
+
r.stderr.should == ''
|
35
|
+
r.facts['fqdn'].should =~ /vm/
|
36
|
+
r.exit_code.should == 0
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'check puppet_resource returns an exit code of 0' do
|
41
41
|
puppet_resource('user') do |r|
|
42
|
-
r
|
43
|
-
r
|
42
|
+
r.stderr.should == ''
|
43
|
+
r.exit_code.should == 0
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'check puppet apply with just a notice' do
|
48
48
|
puppet_apply('notice("foo")') do |r|
|
49
|
-
r
|
50
|
-
r
|
51
|
-
r
|
49
|
+
r.stdout.should =~ /foo/
|
50
|
+
r.stderr.should == ''
|
51
|
+
r.exit_code.should == 0
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'try puppet apply with debug mode' do
|
56
56
|
puppet_apply(:code => 'notice("foo")', :debug => true) do |r|
|
57
|
-
r
|
58
|
-
r
|
59
|
-
r
|
60
|
-
r
|
57
|
+
r.stdout.should =~ /foo/
|
58
|
+
r.stdout.should =~ /Debug:/
|
59
|
+
r.stderr.should == ''
|
60
|
+
r.exit_code.should == 0
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
64
|
it 'try puppet apply with trace off' do
|
65
65
|
puppet_apply(:code => 'notice("foo")', :trace => false) do |r|
|
66
|
-
r
|
67
|
-
r
|
68
|
-
r
|
66
|
+
r.stdout.should =~ /foo/
|
67
|
+
r.stderr.should == ''
|
68
|
+
r.exit_code.should == 0
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -80,9 +80,9 @@ describe "basic tests:" do
|
|
80
80
|
}
|
81
81
|
EOS
|
82
82
|
puppet_apply(pp) do |r|
|
83
|
-
r
|
84
|
-
r
|
85
|
-
r
|
83
|
+
r.stdout.should =~ /Param1: bar/
|
84
|
+
r.stderr.should == ''
|
85
|
+
r.exit_code.should == 0
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.2
|
10
|
+
version: 1.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ken Barber
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-
|
18
|
+
date: 2013-05-22 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rspec-system
|
@@ -25,11 +25,19 @@ dependencies:
|
|
25
25
|
requirements:
|
26
26
|
- - ~>
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
hash:
|
28
|
+
hash: 11
|
29
|
+
segments:
|
30
|
+
- 1
|
31
|
+
- 2
|
32
|
+
version: "1.2"
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
hash: 31
|
29
36
|
segments:
|
30
37
|
- 1
|
38
|
+
- 2
|
31
39
|
- 0
|
32
|
-
version:
|
40
|
+
version: 1.2.0
|
33
41
|
type: :runtime
|
34
42
|
version_requirements: *id001
|
35
43
|
description:
|