cucumber-puppet 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/bin/cucumber-puppet-gen +14 -0
- data/lib/cucumber-puppet/puppet.rb +4 -18
- data/lib/cucumber-puppet/steps.rb +7 -2
- data/lib/generators/world/steps/puppet.rb +19 -13
- metadata +75 -22
data/VERSION.yml
CHANGED
data/bin/cucumber-puppet-gen
CHANGED
@@ -65,6 +65,19 @@ module CucumberPuppetGenerators
|
|
65
65
|
file('site.pp', 'site.pp', "#{destdir}/site.pp")
|
66
66
|
end
|
67
67
|
|
68
|
+
class TestsuiteGenerator < Templater::Generator
|
69
|
+
def self.source_root
|
70
|
+
File.join(File.dirname(__FILE__), '..', 'lib', 'generators', 'testsuite')
|
71
|
+
end
|
72
|
+
|
73
|
+
desc <<-DESC
|
74
|
+
Generate a test suite for puppet features
|
75
|
+
cucumber-puppet-gen testsuite
|
76
|
+
DESC
|
77
|
+
|
78
|
+
glob!
|
79
|
+
end
|
80
|
+
|
68
81
|
class WorldGenerator < Templater::Generator
|
69
82
|
def source_root
|
70
83
|
File.join(File.dirname(__FILE__), '..', 'lib', 'generators', 'world')
|
@@ -91,6 +104,7 @@ module CucumberPuppetGenerators
|
|
91
104
|
add :feature, FeatureGenerator
|
92
105
|
add :policy, PolicyGenerator
|
93
106
|
add :testcase, TestcaseGenerator
|
107
|
+
add :testsuite, TestsuiteGenerator
|
94
108
|
add :world, WorldGenerator
|
95
109
|
|
96
110
|
end
|
@@ -61,25 +61,11 @@ class CucumberPuppet
|
|
61
61
|
node.merge(@facts)
|
62
62
|
end
|
63
63
|
|
64
|
+
# Compile our catalog
|
64
65
|
begin
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
rescue NameError
|
69
|
-
@catalog = Puppet::Node::Catalog.find(node.name, :use_node => node)
|
70
|
-
end
|
71
|
-
rescue => detail
|
72
|
-
if Puppet[:trace]
|
73
|
-
puts detail.backtrace
|
74
|
-
end
|
75
|
-
if detail.is_a?(XMLRPC::FaultException)
|
76
|
-
$stderr.puts detail.message
|
77
|
-
elsif detail.is_a?(Puppet::Error)
|
78
|
-
raise Puppet::Error, detail.message
|
79
|
-
else
|
80
|
-
$stderr.puts detail
|
81
|
-
end
|
82
|
-
exit 1
|
66
|
+
@catalog = Puppet::Resource::Catalog.indirection.find(node.name, :use_node => node)
|
67
|
+
rescue NameError
|
68
|
+
@catalog = Puppet::Node::Catalog.find(node.name, :use_node => node)
|
83
69
|
end
|
84
70
|
|
85
71
|
# XXX could not find this in puppet
|
@@ -12,10 +12,15 @@ Given /^I use storeconfigs$/ do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
When /^I compile its catalog$/ do
|
15
|
+
compile_catalog(@node)
|
16
|
+
end
|
17
|
+
|
18
|
+
When /^I try to compile its catalog$/ do
|
15
19
|
@compile_error = false
|
16
20
|
begin
|
17
21
|
compile_catalog(@node)
|
18
|
-
rescue
|
22
|
+
rescue => e
|
23
|
+
@compile_error_msg = e
|
19
24
|
@compile_error = true
|
20
25
|
end
|
21
26
|
end
|
@@ -41,6 +46,6 @@ Then /^all "(before|notify|require|subscribe)" should resolve$/ do |parameter|
|
|
41
46
|
end
|
42
47
|
|
43
48
|
Then /^compilation should succeed$/ do
|
44
|
-
fail("Catalog compilation failed
|
49
|
+
fail("Catalog compilation failed: #{@compile_error_msg}") unless
|
45
50
|
@catalog.is_a?(Puppet::Resource::Catalog)
|
46
51
|
end
|
@@ -60,12 +60,11 @@ Given /^it is a virtual node$/ do
|
|
60
60
|
end
|
61
61
|
|
62
62
|
When /^I compile the catalog$/ do
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
end
|
63
|
+
steps %Q{ When I compile its catalog }
|
64
|
+
end
|
65
|
+
|
66
|
+
When /^I try to compile the catalog$/ do
|
67
|
+
steps %Q{ When I try to compile its catalog }
|
69
68
|
end
|
70
69
|
|
71
70
|
Then /^compilation should fail$/ do
|
@@ -93,15 +92,17 @@ Then /^the [a-z]* should have an? "([^\"]*)" of "([^\"]*)"$/ do |property, value
|
|
93
92
|
value = value.split
|
94
93
|
end
|
95
94
|
|
96
|
-
prop =
|
95
|
+
prop = []
|
96
|
+
@resource[property].each do |p|
|
97
|
+
prop << p.to_s
|
98
|
+
end
|
97
99
|
elsif @resource[property].is_a?(String)
|
98
100
|
prop = @resource[property]
|
99
101
|
else
|
100
102
|
fail "Class #{@resource[property].class} not supported. Please modify steps to accomodate."
|
101
103
|
end
|
102
104
|
|
103
|
-
fail "Resource #{@resource} had #{property}='#{
|
104
|
-
unless prop == value
|
105
|
+
fail "Resource #{@resource} had #{property}='#{prop ? prop.to_s : "<empty>"}', not '#{value}'" unless prop == value
|
105
106
|
end
|
106
107
|
|
107
108
|
Then /^the [a-z]* should notify "([^\"]*)"$/ do |res|
|
@@ -121,9 +122,9 @@ Then /^the [a-z]* should require "([^\"]*)"$/ do |res|
|
|
121
122
|
break
|
122
123
|
end
|
123
124
|
end
|
124
|
-
fail unless found
|
125
|
+
fail("#{@resource} should require #{res}") unless found
|
125
126
|
else
|
126
|
-
fail unless req.to_s == res
|
127
|
+
fail("#{@resource} should require #{res}") unless req.to_s == res
|
127
128
|
end
|
128
129
|
steps %Q{
|
129
130
|
Then the catalog should contain "#{res}"
|
@@ -131,7 +132,7 @@ Then /^the [a-z]* should require "([^\"]*)"$/ do |res|
|
|
131
132
|
end
|
132
133
|
|
133
134
|
Then /^the catalog should contain "([^\"]*)"$/ do |res|
|
134
|
-
fail unless resource(res)
|
135
|
+
fail("#{res} not in catalog") unless resource(res)
|
135
136
|
end
|
136
137
|
|
137
138
|
Then /^the state should be "([^\"]*)"$/ do |state|
|
@@ -140,5 +141,10 @@ end
|
|
140
141
|
|
141
142
|
Then /^there should be a resource "([^\"]*)"$/ do |res|
|
142
143
|
@resource = resource(res)
|
143
|
-
fail unless @resource
|
144
|
+
fail("#{res} not in catalog") unless @resource
|
145
|
+
end
|
146
|
+
|
147
|
+
Then /^there should be no resource "([^\"]*)"$/ do |res|
|
148
|
+
@resource = resource(res)
|
149
|
+
fail("#{@resource} in catalog although it shouldn't be") if @resource
|
144
150
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-puppet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 4
|
10
|
+
version: 0.3.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Nikolay Sturm
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-09-04 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: cucumber
|
@@ -25,12 +25,10 @@ dependencies:
|
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
hash:
|
28
|
+
hash: 3
|
29
29
|
segments:
|
30
30
|
- 0
|
31
|
-
|
32
|
-
- 4
|
33
|
-
version: 0.6.4
|
31
|
+
version: "0"
|
34
32
|
type: :runtime
|
35
33
|
version_requirements: *id001
|
36
34
|
- !ruby/object:Gem::Dependency
|
@@ -41,29 +39,84 @@ dependencies:
|
|
41
39
|
requirements:
|
42
40
|
- - ">="
|
43
41
|
- !ruby/object:Gem::Version
|
44
|
-
hash:
|
42
|
+
hash: 3
|
45
43
|
segments:
|
46
44
|
- 0
|
47
|
-
|
48
|
-
- 0
|
49
|
-
version: 0.2.0
|
45
|
+
version: "0"
|
50
46
|
type: :runtime
|
51
47
|
version_requirements: *id002
|
52
48
|
- !ruby/object:Gem::Dependency
|
53
|
-
name:
|
49
|
+
name: puppet
|
54
50
|
prerelease: false
|
55
51
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
52
|
none: false
|
57
53
|
requirements:
|
58
54
|
- - ">="
|
59
55
|
- !ruby/object:Gem::Version
|
60
|
-
hash:
|
56
|
+
hash: 3
|
61
57
|
segments:
|
62
|
-
- 1
|
63
58
|
- 0
|
64
|
-
version: "
|
59
|
+
version: "0"
|
65
60
|
type: :runtime
|
66
61
|
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: templater
|
64
|
+
prerelease: false
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
hash: 3
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
74
|
+
type: :runtime
|
75
|
+
version_requirements: *id004
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: facter
|
78
|
+
prerelease: false
|
79
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - "="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
hash: 17
|
85
|
+
segments:
|
86
|
+
- 1
|
87
|
+
- 5
|
88
|
+
- 9
|
89
|
+
version: 1.5.9
|
90
|
+
type: :development
|
91
|
+
version_requirements: *id005
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: ronn
|
94
|
+
prerelease: false
|
95
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
hash: 3
|
101
|
+
segments:
|
102
|
+
- 0
|
103
|
+
version: "0"
|
104
|
+
type: :development
|
105
|
+
version_requirements: *id006
|
106
|
+
- !ruby/object:Gem::Dependency
|
107
|
+
name: rspec
|
108
|
+
prerelease: false
|
109
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
hash: 3
|
115
|
+
segments:
|
116
|
+
- 0
|
117
|
+
version: "0"
|
118
|
+
type: :development
|
119
|
+
version_requirements: *id007
|
67
120
|
description: cucumber-puppet is a tool for behavioral testing of Puppet catalogs
|
68
121
|
email: cucumber-puppet@erisiandiscord.de
|
69
122
|
executables:
|
@@ -86,15 +139,15 @@ files:
|
|
86
139
|
- man/cucumber-puppet.1
|
87
140
|
- man/cucumber-puppet-gen.1
|
88
141
|
- VERSION.yml
|
89
|
-
- lib/generators/world/
|
90
|
-
- lib/generators/world/
|
142
|
+
- lib/generators/world/support/world.rb
|
143
|
+
- lib/generators/world/support/hooks.rb
|
91
144
|
- lib/generators/world/steps/user.rb
|
92
|
-
- lib/generators/world/steps/file.rb
|
93
|
-
- lib/generators/world/steps/cron.rb
|
94
145
|
- lib/generators/world/steps/puppet.rb
|
146
|
+
- lib/generators/world/steps/cron.rb
|
95
147
|
- lib/generators/world/steps/service.rb
|
96
|
-
- lib/generators/world/
|
97
|
-
- lib/generators/world/
|
148
|
+
- lib/generators/world/steps/package.rb
|
149
|
+
- lib/generators/world/steps/exec.rb
|
150
|
+
- lib/generators/world/steps/file.rb
|
98
151
|
homepage: http://projects.puppetlabs.com/projects/cucumber-puppet
|
99
152
|
licenses: []
|
100
153
|
|