puppet-retrospec 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +17 -0
- data/CHANGELOG.md +11 -0
- data/DEVELOPMENT.md +3 -0
- data/Gemfile +10 -9
- data/Gemfile.lock +2 -0
- data/README.md +211 -273
- data/Rakefile +8 -8
- data/VERSION +1 -1
- data/lib/retrospec-puppet.rb +3 -3
- data/lib/retrospec/plugins/v1/plugin/conditional.rb +5 -6
- data/lib/retrospec/plugins/v1/plugin/exceptions.rb +17 -0
- data/lib/retrospec/plugins/v1/plugin/generators.rb +7 -0
- data/lib/retrospec/plugins/v1/plugin/generators/fact_generator.rb +18 -10
- data/lib/retrospec/plugins/v1/plugin/generators/function_generator.rb +187 -0
- data/lib/retrospec/plugins/v1/plugin/generators/module_generator.rb +25 -26
- data/lib/retrospec/plugins/v1/plugin/generators/{facter.rb → parsers/facter.rb} +28 -35
- data/lib/retrospec/plugins/v1/plugin/generators/parsers/function.rb +91 -0
- data/lib/retrospec/plugins/v1/plugin/generators/parsers/type.rb +79 -0
- data/lib/retrospec/plugins/v1/plugin/generators/provider_generator.rb +107 -0
- data/lib/retrospec/plugins/v1/plugin/generators/schema_generator.rb +221 -0
- data/lib/retrospec/plugins/v1/plugin/generators/type_generator.rb +118 -0
- data/lib/retrospec/plugins/v1/plugin/helpers.rb +3 -7
- data/lib/retrospec/plugins/v1/plugin/puppet.rb +141 -60
- data/lib/retrospec/plugins/v1/plugin/puppet_module.rb +29 -26
- data/lib/retrospec/plugins/v1/plugin/resource.rb +6 -7
- data/lib/retrospec/plugins/v1/plugin/spec_object.rb +5 -8
- data/lib/retrospec/plugins/v1/plugin/template_helpers.rb +9 -10
- data/lib/retrospec/plugins/v1/plugin/templates/clone-hook +15 -8
- data/lib/retrospec/plugins/v1/plugin/type_code.rb +4 -4
- data/lib/retrospec/plugins/v1/plugin/variable_store.rb +26 -30
- data/lib/retrospec/plugins/v1/plugin/version.rb +1 -1
- data/puppet-retrospec.gemspec +43 -4
- data/spec/fixtures/facts/oracle_controls.rb +38 -0
- data/spec/fixtures/fixture_modules/required_parameters/manifests/init.pp +8 -0
- data/spec/fixtures/fixture_modules/sample_module/lib/facter/fix_installed.rb +11 -0
- data/spec/fixtures/fixture_modules/sample_module/lib/puppet/functions/awesome_parser.rb +13 -0
- data/spec/fixtures/fixture_modules/sample_module/lib/puppet/functions/reduce.rb +31 -0
- data/spec/fixtures/fixture_modules/sample_module/lib/puppet/parser/functions/bad_sha1.rb +6 -0
- data/spec/fixtures/fixture_modules/sample_module/lib/puppet/parser/functions/defined.rb +94 -0
- data/spec/fixtures/fixture_modules/sample_module/lib/puppet/parser/functions/sha1.rb +6 -0
- data/spec/fixtures/fixture_modules/sample_module/spec/unit/facter/fix_installed_spec.rb +21 -0
- data/spec/fixtures/modules/tomcat/files/.gitkeep +0 -0
- data/spec/fixtures/modules/tomcat/templates/.gitkeep +0 -0
- data/spec/fixtures/modules/tomcat/tests/.gitkeep +0 -0
- data/spec/fixtures/providers/bmc/ipmitool.rb +188 -0
- data/spec/fixtures/providers/bmcuser/ipmitool.rb +140 -0
- data/spec/fixtures/types/bmc.rb +102 -0
- data/spec/fixtures/types/bmcuser.rb +46 -0
- data/spec/fixtures/types/db_opatch.rb +93 -0
- data/spec/integration/retrospec_spec.rb +1 -3
- data/spec/spec_helper.rb +33 -6
- data/spec/unit/conditional_spec.rb +12 -15
- data/spec/unit/generators/fact_generater_spec.rb +49 -17
- data/spec/unit/generators/function_generator_spec.rb +301 -0
- data/spec/unit/generators/function_spec.rb +67 -0
- data/spec/unit/generators/parsers/fact_spec.rb +62 -0
- data/spec/unit/generators/parsers/provider_spec.rb +44 -0
- data/spec/unit/generators/parsers/type_spec.rb +93 -0
- data/spec/unit/generators/provider_generator_spec.rb +120 -0
- data/spec/unit/generators/schema_generator_spec.rb +122 -0
- data/spec/unit/generators/type_generator_spec.rb +173 -0
- data/spec/unit/module_spec.rb +7 -10
- data/spec/unit/plugin_spec.rb +213 -15
- data/spec/unit/puppet-retrospec_spec.rb +81 -100
- data/spec/unit/resource_spec.rb +16 -17
- data/spec/unit/spec_object_spec.rb +46 -0
- data/spec/unit/type_code_spec.rb +9 -11
- data/spec/unit/variable_store_spec.rb +41 -43
- metadata +54 -4
- data/spec/unit/generators/fact_spec.rb +0 -58
data/spec/unit/type_code_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe 'type_code' do
|
4
4
|
after :all do
|
5
5
|
# enabling the removal slows down tests, but from time to time we may need to
|
6
6
|
FileUtils.rm_rf(fixture_modules_path) if ENV['RETROSPEC_CLEAN_UP_TEST_MODULES'] =~ /true/
|
@@ -11,23 +11,22 @@ describe "type_code" do
|
|
11
11
|
FileUtils.rm_rf(fixture_modules_path) if ENV['RETROSPEC_CLEAN_UP_TEST_MODULES'] =~ /true/
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
14
|
describe 'one resource module' do
|
16
15
|
before :all do
|
17
16
|
@path = File.expand_path(File.join('spec', 'fixtures', 'fixture_modules', 'one_resource_module'))
|
18
17
|
end
|
19
18
|
|
20
19
|
before :each do
|
21
|
-
@opts = {:module_path => @path, :enable_beaker_tests => false,
|
22
|
-
|
20
|
+
@opts = { :module_path => @path, :enable_beaker_tests => false,
|
21
|
+
:enable_user_templates => false, :template_dir => nil }
|
23
22
|
end
|
24
|
-
let(:instance) {Utilities::PuppetModule.send :new}
|
23
|
+
let(:instance) { Utilities::PuppetModule.send :new }
|
25
24
|
|
26
25
|
it 'should initialize correctly scope name' do
|
27
26
|
m = instance
|
28
27
|
m.module_path = @opts[:module_path]
|
29
28
|
m.create_tmp_module_path(@opts[:module_path])
|
30
|
-
test_type = m.types.find {|x| x.name == 'one_resource::another_resource'}
|
29
|
+
test_type = m.types.find { |x| x.name == 'one_resource::another_resource' }
|
31
30
|
expect(TypeCode.new(test_type).scope_name).to eq('one_resource::another_resource')
|
32
31
|
expect(TypeCode.new(test_type).type).to eq(test_type)
|
33
32
|
end
|
@@ -36,21 +35,20 @@ describe "type_code" do
|
|
36
35
|
m = instance
|
37
36
|
m.module_path = @opts[:module_path]
|
38
37
|
m.create_tmp_module_path(@opts[:module_path])
|
39
|
-
test_type = m.types.find {|x| x.name == 'one_resource::another_resource'}
|
38
|
+
test_type = m.types.find { |x| x.name == 'one_resource::another_resource' }
|
40
39
|
expect(TypeCode.new(test_type).variables.size).to eq(4)
|
41
40
|
end
|
42
41
|
end
|
43
42
|
|
44
43
|
describe 'zero module' do
|
45
|
-
let(:instance) {Utilities::PuppetModule.send :new}
|
44
|
+
let(:instance) { Utilities::PuppetModule.send :new }
|
46
45
|
it 'should respond correctly when class is empty' do
|
47
46
|
my_path = File.expand_path(File.join('spec', 'fixtures', 'fixture_modules', 'zero_resource_module'))
|
48
47
|
m = instance
|
49
48
|
m.module_path = my_path
|
50
49
|
m.create_tmp_module_path(my_path)
|
51
|
-
test_type = m.types.find {|x| x.name == 'empty_class'}
|
52
|
-
expect{TypeCode.new(test_type).variables}.to_not raise_error
|
50
|
+
test_type = m.types.find { |x| x.name == 'empty_class' }
|
51
|
+
expect { TypeCode.new(test_type).variables }.to_not raise_error
|
53
52
|
end
|
54
53
|
end
|
55
|
-
|
56
54
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
let(:instance) {Utilities::PuppetModule.send :new}
|
3
|
+
describe 'variable_store' do
|
4
|
+
let(:instance) { Utilities::PuppetModule.send :new }
|
5
5
|
|
6
6
|
after :all do
|
7
7
|
# enabling the removal slows down tests, but from time to time we may need to
|
@@ -15,8 +15,8 @@ describe "variable_store" do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
before :each do
|
18
|
-
@opts = {:module_path => @path, :enable_beaker_tests => false,
|
19
|
-
|
18
|
+
@opts = { :module_path => @path, :enable_beaker_tests => false,
|
19
|
+
:enable_user_templates => false, :template_dir => nil }
|
20
20
|
@module = instance
|
21
21
|
@module.module_path = @opts[:module_path]
|
22
22
|
@module.create_tmp_module_path(@opts[:module_path])
|
@@ -27,46 +27,46 @@ describe "variable_store" do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'should resolve a string' do
|
30
|
-
test_type = @module.types.find {|x| x.name == 'one_resource::another_resource'}
|
30
|
+
test_type = @module.types.find { |x| x.name == 'one_resource::another_resource' }
|
31
31
|
r = Resource.all(test_type).first
|
32
|
-
string1 = ObjectSpace.each_object(Puppet::Parser::AST::String).find {|x| x.to_s == "\"value1\"" }
|
32
|
+
string1 = ObjectSpace.each_object(Puppet::Parser::AST::String).find { |x| x.to_s == "\"value1\"" }
|
33
33
|
expect(VariableStore.resolve(string1)).to eq("\"value1\"")
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'should resolve a variable' do
|
37
|
-
test_type = @module.types.find {|x| x.name == 'one_resource::another_resource'}
|
37
|
+
test_type = @module.types.find { |x| x.name == 'one_resource::another_resource' }
|
38
38
|
r = Resource.all(test_type).first
|
39
|
-
var1 = ObjectSpace.each_object(Puppet::Parser::AST::Variable).find {|x| x.to_s == '$file_name' }
|
40
|
-
VariableStore.add(var1,'/tmp/test3')
|
41
|
-
expect(VariableStore.resolve(var1)).to eq(
|
39
|
+
var1 = ObjectSpace.each_object(Puppet::Parser::AST::Variable).find { |x| x.to_s == '$file_name' }
|
40
|
+
VariableStore.add(var1, '/tmp/test3')
|
41
|
+
expect(VariableStore.resolve(var1)).to eq('/tmp/test3')
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'should resolve a basic vardef type' do
|
45
|
-
test_type = @module.types.find {|x| x.name == 'one_resource::another_resource'}
|
45
|
+
test_type = @module.types.find { |x| x.name == 'one_resource::another_resource' }
|
46
46
|
VariableStore.populate(test_type)
|
47
|
-
vardef1 = ObjectSpace.each_object(Puppet::Parser::AST::VarDef).find {|x| x.name.value == 'some_var'}
|
48
|
-
expect(VariableStore.resolve(vardef1)).to eq(
|
47
|
+
vardef1 = ObjectSpace.each_object(Puppet::Parser::AST::VarDef).find { |x| x.name.value == 'some_var' }
|
48
|
+
expect(VariableStore.resolve(vardef1)).to eq('oohhhh')
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'should resolve a concat vardef type' do
|
52
|
-
test_type = @module.types.find {|x| x.name == 'one_resource::another_resource'}
|
52
|
+
test_type = @module.types.find { |x| x.name == 'one_resource::another_resource' }
|
53
53
|
VariableStore.populate(test_type)
|
54
|
-
vardef2 =
|
55
|
-
expect(VariableStore.resolve(vardef2)).to eq(
|
54
|
+
vardef2 = ObjectSpace.each_object(Puppet::Parser::AST::VarDef).find { |x| x.name.value == 'concat_var' }
|
55
|
+
expect(VariableStore.resolve(vardef2)).to eq('/tmp/test3/test3183/oohhhh')
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'should resolve vardef/concat with parameter value' do
|
59
|
-
test_type = @module.types.find {|x| x.name == 'one_resource::another_resource'}
|
59
|
+
test_type = @module.types.find { |x| x.name == 'one_resource::another_resource' }
|
60
60
|
VariableStore.populate(test_type)
|
61
|
-
vardef3 =
|
62
|
-
expect(VariableStore.resolve(vardef3)).to eq(
|
61
|
+
vardef3 = ObjectSpace.each_object(Puppet::Parser::AST::VarDef).find { |x| x.name.value == 'cli_modules' }
|
62
|
+
expect(VariableStore.resolve(vardef3)).to eq('/etc/hammer/cli.modules.d')
|
63
63
|
end
|
64
64
|
|
65
65
|
describe '#add' do
|
66
66
|
it 'should store the value correctly' do
|
67
|
-
test_type = @module.types.find {|x| x.name == 'one_resource::another_resource'}
|
68
|
-
string1 = ObjectSpace.each_object(Puppet::Parser::AST::String).find {|x| x.to_s == "\"value1\"" }
|
69
|
-
expect(VariableStore.add(string1, 'blah')).to eq(
|
67
|
+
test_type = @module.types.find { |x| x.name == 'one_resource::another_resource' }
|
68
|
+
string1 = ObjectSpace.each_object(Puppet::Parser::AST::String).find { |x| x.to_s == "\"value1\"" }
|
69
|
+
expect(VariableStore.add(string1, 'blah')).to eq('blah')
|
70
70
|
expect(VariableStore.lookup(string1)).to eq('blah')
|
71
71
|
end
|
72
72
|
|
@@ -76,61 +76,59 @@ describe "variable_store" do
|
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'should store vardef as is' do
|
79
|
-
test_type = @module.types.find {|x| x.name == 'one_resource::another_resource'}
|
79
|
+
test_type = @module.types.find { |x| x.name == 'one_resource::another_resource' }
|
80
80
|
VariableStore.populate(test_type)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
84
|
describe 'populate' do
|
85
|
-
let(:instance) {Utilities::PuppetModule.send :new}
|
85
|
+
let(:instance) { Utilities::PuppetModule.send :new }
|
86
86
|
|
87
87
|
before :each do
|
88
|
-
|
89
88
|
end
|
90
89
|
it 'should load an resolve vars from the parent type' do
|
91
90
|
m = instance
|
92
91
|
m.module_path = @opts[:module_path]
|
93
92
|
m.create_tmp_module_path(@opts[:module_path])
|
94
|
-
test_type = m.types.find {|x| x.name == 'one_resource::another_resource'}
|
93
|
+
test_type = m.types.find { |x| x.name == 'one_resource::another_resource' }
|
95
94
|
VariableStore.populate(test_type)
|
96
|
-
vars = {
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
95
|
+
vars = { '$var1' => 'value1',
|
96
|
+
'$var2' => 'value2',
|
97
|
+
'$file_name' => '/tmp/test3',
|
98
|
+
'$config_base_path' => '/etc/hammer',
|
99
|
+
'$config_set' => 'param1_value',
|
100
|
+
'$concat_var' => '/tmp/test3/test3183/oohhhh',
|
101
|
+
'$one_resource::params::param1_var1' => 'param1_value',
|
102
|
+
'$one_resource::params::var1' => 'params_class_value1',
|
103
|
+
'$one_resource::params::var2' => 'value2',
|
104
|
+
'$some_var' => 'oohhhh',
|
105
|
+
'$cli_modules' => '/etc/hammer/cli.modules.d',
|
106
|
+
'$inherited_variable' => 'params_class_value1',
|
108
107
|
}
|
109
|
-
vars.each do |k,v|
|
108
|
+
vars.each do |k, v|
|
110
109
|
expect(VariableStore.instance.store.keys.include?(k)).to be true
|
111
110
|
expect(VariableStore.instance.store[k]).to eq(v)
|
112
111
|
end
|
113
112
|
end
|
114
113
|
|
115
114
|
xit 'should resolve a fact' do
|
116
|
-
#test_type = @module.types.find {|x| x.name == 'one_resource::inherits_params'}
|
115
|
+
# test_type = @module.types.find {|x| x.name == 'one_resource::inherits_params'}
|
117
116
|
end
|
118
117
|
|
119
118
|
it 'should resolve a parent parameter' do
|
120
119
|
m = instance
|
121
120
|
m.module_path = @opts[:module_path]
|
122
121
|
m.create_tmp_module_path(@opts[:module_path])
|
123
|
-
test_type = m.types.find {|x| x.name == 'one_resource::another_resource'}
|
122
|
+
test_type = m.types.find { |x| x.name == 'one_resource::another_resource' }
|
124
123
|
VariableStore.populate(test_type)
|
125
124
|
expect(VariableStore.instance.store['$config_set']).to eq('param1_value')
|
126
|
-
|
127
125
|
end
|
128
126
|
|
129
127
|
it 'should resolve a parent variable' do
|
130
128
|
m = instance
|
131
129
|
m.module_path = @opts[:module_path]
|
132
130
|
m.create_tmp_module_path(@opts[:module_path])
|
133
|
-
test_type = m.types.find {|x| x.name == 'one_resource::another_resource'}
|
131
|
+
test_type = m.types.find { |x| x.name == 'one_resource::another_resource' }
|
134
132
|
VariableStore.populate(test_type)
|
135
133
|
expect(VariableStore.instance.store['$inherited_variable']).to eq('params_class_value1')
|
136
134
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-retrospec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Corey Osman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trollop
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: facets
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,8 +188,10 @@ extra_rdoc_files:
|
|
174
188
|
files:
|
175
189
|
- .document
|
176
190
|
- .rspec
|
191
|
+
- .rubocop.yml
|
177
192
|
- .travis.yml
|
178
193
|
- CHANGELOG.md
|
194
|
+
- DEVELOPMENT.md
|
179
195
|
- Gemfile
|
180
196
|
- Gemfile.lock
|
181
197
|
- LICENSE
|
@@ -184,9 +200,17 @@ files:
|
|
184
200
|
- VERSION
|
185
201
|
- lib/retrospec-puppet.rb
|
186
202
|
- lib/retrospec/plugins/v1/plugin/conditional.rb
|
203
|
+
- lib/retrospec/plugins/v1/plugin/exceptions.rb
|
204
|
+
- lib/retrospec/plugins/v1/plugin/generators.rb
|
187
205
|
- lib/retrospec/plugins/v1/plugin/generators/fact_generator.rb
|
188
|
-
- lib/retrospec/plugins/v1/plugin/generators/
|
206
|
+
- lib/retrospec/plugins/v1/plugin/generators/function_generator.rb
|
189
207
|
- lib/retrospec/plugins/v1/plugin/generators/module_generator.rb
|
208
|
+
- lib/retrospec/plugins/v1/plugin/generators/parsers/facter.rb
|
209
|
+
- lib/retrospec/plugins/v1/plugin/generators/parsers/function.rb
|
210
|
+
- lib/retrospec/plugins/v1/plugin/generators/parsers/type.rb
|
211
|
+
- lib/retrospec/plugins/v1/plugin/generators/provider_generator.rb
|
212
|
+
- lib/retrospec/plugins/v1/plugin/generators/schema_generator.rb
|
213
|
+
- lib/retrospec/plugins/v1/plugin/generators/type_generator.rb
|
190
214
|
- lib/retrospec/plugins/v1/plugin/helpers.rb
|
191
215
|
- lib/retrospec/plugins/v1/plugin/puppet.rb
|
192
216
|
- lib/retrospec/plugins/v1/plugin/puppet_module.rb
|
@@ -201,10 +225,19 @@ files:
|
|
201
225
|
- spec/fixtures/facts/datacenter_facts.rb
|
202
226
|
- spec/fixtures/facts/facts_with_methods.rb
|
203
227
|
- spec/fixtures/facts/node_role.rb
|
228
|
+
- spec/fixtures/facts/oracle_controls.rb
|
204
229
|
- spec/fixtures/fixture_modules/one_resource_module/manifests/another_resource.pp
|
205
230
|
- spec/fixtures/fixture_modules/one_resource_module/manifests/inherits_params.pp
|
206
231
|
- spec/fixtures/fixture_modules/one_resource_module/manifests/one_resource_class.pp
|
207
232
|
- spec/fixtures/fixture_modules/one_resource_module/manifests/params.pp
|
233
|
+
- spec/fixtures/fixture_modules/required_parameters/manifests/init.pp
|
234
|
+
- spec/fixtures/fixture_modules/sample_module/lib/facter/fix_installed.rb
|
235
|
+
- spec/fixtures/fixture_modules/sample_module/lib/puppet/functions/awesome_parser.rb
|
236
|
+
- spec/fixtures/fixture_modules/sample_module/lib/puppet/functions/reduce.rb
|
237
|
+
- spec/fixtures/fixture_modules/sample_module/lib/puppet/parser/functions/bad_sha1.rb
|
238
|
+
- spec/fixtures/fixture_modules/sample_module/lib/puppet/parser/functions/defined.rb
|
239
|
+
- spec/fixtures/fixture_modules/sample_module/lib/puppet/parser/functions/sha1.rb
|
240
|
+
- spec/fixtures/fixture_modules/sample_module/spec/unit/facter/fix_installed_spec.rb
|
208
241
|
- spec/fixtures/fixture_modules/zero_resource_module/manifests/empty_class.pp
|
209
242
|
- spec/fixtures/fixture_modules/zero_resource_module/manifests/not_a_resource_defination.pp
|
210
243
|
- spec/fixtures/fixture_modules/zero_resource_module/metadata.json
|
@@ -680,6 +713,7 @@ files:
|
|
680
713
|
- spec/fixtures/modules/stdlib/tests/has_ip_address.pp
|
681
714
|
- spec/fixtures/modules/stdlib/tests/has_ip_network.pp
|
682
715
|
- spec/fixtures/modules/stdlib/tests/init.pp
|
716
|
+
- spec/fixtures/modules/tomcat/.bundle/config
|
683
717
|
- spec/fixtures/modules/tomcat/.gitignore
|
684
718
|
- spec/fixtures/modules/tomcat/.puppet-lint.rc
|
685
719
|
- spec/fixtures/modules/tomcat/.travis.yml
|
@@ -698,6 +732,7 @@ files:
|
|
698
732
|
- spec/fixtures/modules/tomcat/examples/instance_with_role_and_user.pp
|
699
733
|
- spec/fixtures/modules/tomcat/examples/jsvc_install_from_source.pp
|
700
734
|
- spec/fixtures/modules/tomcat/examples/multiple_instances.pp
|
735
|
+
- spec/fixtures/modules/tomcat/files/.gitkeep
|
701
736
|
- spec/fixtures/modules/tomcat/manifests/config/server.pp
|
702
737
|
- spec/fixtures/modules/tomcat/manifests/config/server/connector.pp
|
703
738
|
- spec/fixtures/modules/tomcat/manifests/config/server/context.pp
|
@@ -717,15 +752,30 @@ files:
|
|
717
752
|
- spec/fixtures/modules/tomcat/manifests/setenv/entry.pp
|
718
753
|
- spec/fixtures/modules/tomcat/manifests/war.pp
|
719
754
|
- spec/fixtures/modules/tomcat/metadata.json
|
755
|
+
- spec/fixtures/modules/tomcat/templates/.gitkeep
|
756
|
+
- spec/fixtures/modules/tomcat/tests/.gitkeep
|
757
|
+
- spec/fixtures/providers/bmc/ipmitool.rb
|
758
|
+
- spec/fixtures/providers/bmcuser/ipmitool.rb
|
759
|
+
- spec/fixtures/types/bmc.rb
|
760
|
+
- spec/fixtures/types/bmcuser.rb
|
761
|
+
- spec/fixtures/types/db_opatch.rb
|
720
762
|
- spec/integration/retrospec_spec.rb
|
721
763
|
- spec/spec_helper.rb
|
722
764
|
- spec/unit/conditional_spec.rb
|
723
765
|
- spec/unit/generators/fact_generater_spec.rb
|
724
|
-
- spec/unit/generators/
|
766
|
+
- spec/unit/generators/function_generator_spec.rb
|
767
|
+
- spec/unit/generators/function_spec.rb
|
768
|
+
- spec/unit/generators/parsers/fact_spec.rb
|
769
|
+
- spec/unit/generators/parsers/provider_spec.rb
|
770
|
+
- spec/unit/generators/parsers/type_spec.rb
|
771
|
+
- spec/unit/generators/provider_generator_spec.rb
|
772
|
+
- spec/unit/generators/schema_generator_spec.rb
|
773
|
+
- spec/unit/generators/type_generator_spec.rb
|
725
774
|
- spec/unit/module_spec.rb
|
726
775
|
- spec/unit/plugin_spec.rb
|
727
776
|
- spec/unit/puppet-retrospec_spec.rb
|
728
777
|
- spec/unit/resource_spec.rb
|
778
|
+
- spec/unit/spec_object_spec.rb
|
729
779
|
- spec/unit/type_code_spec.rb
|
730
780
|
- spec/unit/variable_store_spec.rb
|
731
781
|
- vendor/gems/puppet-3.7.3/Gemfile
|
@@ -1,58 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "facter" do
|
4
|
-
|
5
|
-
let(:file) do
|
6
|
-
File.join(fixtures_facts_path , 'node_role.rb')
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'can eval code' do
|
10
|
-
models = Retrospec::Puppet::Generators::Facter.load_fact(file)
|
11
|
-
fact_name = models.facts.keys.first
|
12
|
-
fact_data = models.facts[fact_name]
|
13
|
-
confines = fact_data.confines
|
14
|
-
model_facts = models.facts[fact_name].used_facts
|
15
|
-
global_used_facts = models.global_used_facts
|
16
|
-
expect(fact_name).to eq(:node_role)
|
17
|
-
expect(confines).to eq([{:kernel=>"Windows"}, {:is_virtual=>true}])
|
18
|
-
expect(model_facts).to eq({})
|
19
|
-
expect(global_used_facts).to eq({})
|
20
|
-
end
|
21
|
-
|
22
|
-
describe 'multiple facts' do
|
23
|
-
let(:file) do
|
24
|
-
File.join(fixtures_facts_path , 'datacenter_facts.rb')
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'can eval code with multiple facts' do
|
28
|
-
models = Retrospec::Puppet::Generators::Facter.load_fact(file)
|
29
|
-
global_used_facts = models[:global_used_facts]
|
30
|
-
fact_name = models.facts.keys.first
|
31
|
-
fact_data = models.facts[fact_name]
|
32
|
-
confines = fact_data.confines
|
33
|
-
model_facts = fact_data.used_facts
|
34
|
-
expect(fact_name).to eq(:fact1)
|
35
|
-
expect(confines).to eq([{:kernel=>"Linux"}])
|
36
|
-
expect(model_facts).to eq({})
|
37
|
-
expect(global_used_facts).to eq({})
|
38
|
-
fact_name = models.facts.keys.last
|
39
|
-
fact_data = models.facts[fact_name]
|
40
|
-
confines = fact_data.confines
|
41
|
-
model_facts = fact_data.used_facts
|
42
|
-
expect(fact_name).to eq(:fact2)
|
43
|
-
expect(confines).to eq([{:kernel=>"Windows"}])
|
44
|
-
expect(model_facts).to eq({})
|
45
|
-
expect(global_used_facts).to eq({})
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
describe 'fact value' do
|
50
|
-
let(:file) do
|
51
|
-
File.join(fixtures_facts_path , 'facts_with_methods.rb')
|
52
|
-
end
|
53
|
-
it 'can be processed' do
|
54
|
-
Retrospec::Puppet::Generators::Facter.load_fact(file)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|