beaker 2.18.0 → 2.19.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.
Files changed (77) hide show
  1. checksums.yaml +8 -8
  2. data/HISTORY.md +699 -2
  3. data/acceptance/lib/beaker/acceptance/install_utils.rb +58 -0
  4. data/acceptance/pre_suite/puppet_gem/install.rb +1 -8
  5. data/acceptance/pre_suite/puppet_git/install.rb +6 -65
  6. data/acceptance/pre_suite/puppet_pkg/install.rb +1 -1
  7. data/acceptance/tests/foss_utils/clone_git_repo_on.rb +49 -0
  8. data/beaker.gemspec +2 -0
  9. data/lib/beaker/command.rb +1 -1
  10. data/lib/beaker/dsl/helpers/puppet_helpers.rb +8 -6
  11. data/lib/beaker/dsl/helpers/web_helpers.rb +2 -1
  12. data/lib/beaker/dsl/install_utils/aio_defaults.rb +0 -3
  13. data/lib/beaker/dsl/install_utils/foss_defaults.rb +19 -0
  14. data/lib/beaker/dsl/install_utils/foss_utils.rb +164 -67
  15. data/lib/beaker/dsl/install_utils/pe_defaults.rb +9 -11
  16. data/lib/beaker/dsl/install_utils/pe_utils.rb +48 -64
  17. data/lib/beaker/dsl/install_utils/puppet_utils.rb +43 -0
  18. data/lib/beaker/dsl/install_utils/windows_utils.rb +144 -0
  19. data/lib/beaker/dsl/roles.rb +20 -3
  20. data/lib/beaker/dsl/structure.rb +14 -3
  21. data/lib/beaker/host/freebsd/pkg.rb +18 -0
  22. data/lib/beaker/host/freebsd.rb +2 -0
  23. data/lib/beaker/host/unix/exec.rb +3 -3
  24. data/lib/beaker/host/unix/pkg.rb +37 -0
  25. data/lib/beaker/host/windows/exec.rb +3 -0
  26. data/lib/beaker/host.rb +38 -9
  27. data/lib/beaker/host_prebuilt_steps.rb +21 -11
  28. data/lib/beaker/hypervisor/aws_sdk.rb +22 -18
  29. data/lib/beaker/hypervisor/docker.rb +7 -0
  30. data/lib/beaker/hypervisor/openstack.rb +1 -0
  31. data/lib/beaker/hypervisor/vagrant_virtualbox.rb +10 -5
  32. data/lib/beaker/hypervisor/vmpooler.rb +4 -0
  33. data/lib/beaker/logger.rb +12 -1
  34. data/lib/beaker/options/command_line_parser.rb +9 -0
  35. data/lib/beaker/options/options_hash.rb +3 -296
  36. data/lib/beaker/options/parser.rb +12 -0
  37. data/lib/beaker/options/presets.rb +0 -1
  38. data/lib/beaker/platform.rb +3 -1
  39. data/lib/beaker/ssh_connection.rb +48 -23
  40. data/lib/beaker/test_case.rb +1 -1
  41. data/lib/beaker/version.rb +1 -1
  42. data/spec/beaker/dsl/helpers/puppet_helpers_spec.rb +0 -1
  43. data/spec/beaker/dsl/helpers/web_helpers_spec.rb +10 -1
  44. data/spec/beaker/dsl/install_utils/foss_utils_spec.rb +247 -49
  45. data/spec/beaker/dsl/install_utils/pe_utils_spec.rb +116 -26
  46. data/spec/beaker/dsl/install_utils/puppet_utils_spec.rb +57 -0
  47. data/spec/beaker/dsl/install_utils/windows_utils_spec.rb +132 -0
  48. data/spec/beaker/dsl/roles_spec.rb +36 -5
  49. data/spec/beaker/dsl/structure_spec.rb +9 -2
  50. data/spec/beaker/host/unix/pkg_spec.rb +26 -6
  51. data/spec/beaker/host_prebuilt_steps_spec.rb +3 -2
  52. data/spec/beaker/host_spec.rb +24 -6
  53. data/spec/beaker/hypervisor/aixer_spec.rb +1 -1
  54. data/spec/beaker/hypervisor/aws_sdk_spec.rb +595 -58
  55. data/spec/beaker/hypervisor/docker_spec.rb +2 -1
  56. data/spec/beaker/hypervisor/solaris_spec.rb +1 -0
  57. data/spec/beaker/hypervisor/vagrant_spec.rb +20 -5
  58. data/spec/beaker/hypervisor/vagrant_virtualbox_spec.rb +1 -1
  59. data/spec/beaker/logger_spec.rb +39 -0
  60. data/spec/beaker/options/command_line_parser_spec.rb +2 -2
  61. data/spec/beaker/options/options_hash_spec.rb +1 -102
  62. data/spec/beaker/options/parser_spec.rb +19 -0
  63. data/spec/beaker/options/pe_version_scaper_spec.rb +11 -1
  64. data/spec/beaker/options/presets_spec.rb +8 -0
  65. data/spec/beaker/ssh_connection_spec.rb +39 -21
  66. data/spec/helpers.rb +9 -3
  67. data/spec/mocks.rb +2 -0
  68. metadata +35 -11
  69. data/lib/beaker/answers/version20.rb +0 -120
  70. data/lib/beaker/answers/version28.rb +0 -121
  71. data/lib/beaker/answers/version30.rb +0 -227
  72. data/lib/beaker/answers/version32.rb +0 -44
  73. data/lib/beaker/answers/version34.rb +0 -51
  74. data/lib/beaker/answers/version38.rb +0 -29
  75. data/lib/beaker/answers/version40.rb +0 -44
  76. data/lib/beaker/answers.rb +0 -143
  77. data/spec/beaker/answers_spec.rb +0 -547
@@ -1,547 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Beaker
4
- describe Answers do
5
- let( :basic_hosts ) { make_hosts( { 'pe_ver' => @ver } ) }
6
- let( :options ) { @options || Beaker::Options::Presets.new.presets }
7
- let( :hosts ) { basic_hosts[0]['roles'] = ['master', 'database', 'dashboard']
8
- basic_hosts[1]['platform'] = 'windows'
9
- basic_hosts }
10
- let( :answers ) { Beaker::Answers.create(@ver, hosts, options) }
11
-
12
- after :each do
13
- ENV.delete('q_puppet_cloud_install')
14
- end
15
-
16
- it 'uses options[:answers] if they are set (override q_puppet_cloud_install for 3.8' do
17
- @ver = '3.8'
18
- options[:answers] = Beaker::Options::OptionsHash.new
19
- options[:answers]['q_puppet_cloud_install'] = 'n'
20
- opts = answers.instance_variable_get(:@options)
21
- @answers = answers.answers
22
- # confirm that the answers were correctly added to the answers object
23
- expect(opts).to be_a_kind_of Beaker::Options::OptionsHash
24
- expect(opts[:answers]['q_puppet_cloud_install']).to be == 'n'
25
- expect(opts[:answers][:q_puppet_cloud_install]).to be == 'n'
26
- hosts.each do |host|
27
- if @answers[host.name]
28
- expect( @answers[host.name][:q_puppet_cloud_install] ).to be == 'n'
29
- end
30
- end
31
- end
32
-
33
- it 'uses ENV[:q_*] if they are set (override q_puppet_cloud_install for 3.8' do
34
- @ver = '3.8'
35
- ENV['q_puppet_cloud_install'] = 'n'
36
- @options = Beaker::Options::Parser.new.parse_args([])
37
-
38
- opts = answers.instance_variable_get(:@options)
39
- @answers = answers.answers
40
- # confirm that the answers were correctly added to the answers object
41
- expect(opts).to be_a_kind_of Beaker::Options::OptionsHash
42
- expect(opts[:answers]['q_puppet_cloud_install']).to be == 'n'
43
- expect(opts[:answers][:q_puppet_cloud_install]).to be == 'n'
44
- hosts.each do |host|
45
- if @answers[host.name]
46
- expect( @answers[host.name][:q_puppet_cloud_install] ).to be == 'n'
47
- end
48
- end
49
- end
50
-
51
- it 'generates 3.4 answers for 4.0 hosts' do
52
- @ver = '4.0'
53
- expect( answers ).to be_a_kind_of Version34
54
- end
55
-
56
- it 'generates 4.0 answers for 3.99 hosts' do
57
- @ver = '3.99'
58
- expect( answers ).to be_a_kind_of Version40
59
- end
60
-
61
- it 'generates 3.8 answers for 3.8 hosts' do
62
- @ver = '3.8'
63
- expect( answers ).to be_a_kind_of Version38
64
- end
65
-
66
- it 'generates 3.4 answers for 3.4 hosts' do
67
- @ver = '3.4'
68
- expect( answers ).to be_a_kind_of Version34
69
- end
70
-
71
- it 'generates 3.2 answers for 3.3 hosts' do
72
- @ver = '3.3'
73
- expect( answers ).to be_a_kind_of Version32
74
- end
75
-
76
- it 'generates 3.2 answers for 3.2 hosts' do
77
- @ver = '3.2'
78
- expect( answers ).to be_a_kind_of Version32
79
- end
80
-
81
- it 'generates 3.0 answers for 3.1 hosts' do
82
- @ver = '3.1'
83
- expect( answers ).to be_a_kind_of Version30
84
- end
85
-
86
- it 'generates 3.0 answers for 3.0 hosts' do
87
- @ver = '3.0'
88
- expect( answers ).to be_a_kind_of Version30
89
- end
90
-
91
- it 'generates 2.8 answers for 2.8 hosts' do
92
- @ver = '2.8'
93
- expect( answers ).to be_a_kind_of Version28
94
- end
95
-
96
- it 'generates 2.0 answers for 2.0 hosts' do
97
- @ver = '2.0'
98
- expect( answers ).to be_a_kind_of Version20
99
- end
100
-
101
- it 'raises an error for an unknown version' do
102
- @ver = 'x.x'
103
- expect{ answers }.to raise_error( NotImplementedError )
104
- end
105
- end
106
-
107
- describe "Masterless Setup" do
108
- let( :ver ) { @ver || '3.0' }
109
- let( :options ) { options = Beaker::Options::Presets.new.presets
110
- options[:masterless] = true
111
- options }
112
- let( :hosts ) { make_hosts({}, 1) }
113
- let( :host ) { hosts[0] }
114
- let( :answers ) { Beaker::Answers.create(ver, hosts, options) }
115
- let( :host_answers ) { answers.answers[host.name] }
116
-
117
-
118
- it 'adds the correct answers' do
119
- expect( host_answers[:q_puppetagent_server] ).to be === host_answers[:q_puppetagent_certname]
120
- expect( host_answers[:q_continue_or_reenter_master_hostname]).to be === 'c'
121
- end
122
-
123
- it 'skips the correct answers' do
124
- expect( host_answers[:q_puppetmaster_install]).to be === 'n'
125
- expect( host_answers[:q_puppet_enterpriseconsole_install] ).to be === 'n'
126
- expect( host_answers[:q_puppetdb_install] ).to be === 'n'
127
- end
128
-
129
- it '3.0: never calls #only_host_with_role in #generate_answers' do
130
- expect( answers.generate_answers ).to_not receive( :only_host_with_role )
131
- end
132
-
133
- it '3.2: never calls #only_host_with_role in #generate_answers' do
134
- @ver = '3.2'
135
- expect( answers.generate_answers ).to_not receive( :only_host_with_role )
136
- end
137
-
138
- it '3.4: never calls #only_host_with_role in #generate_answers' do
139
- @ver = '3.4'
140
- expect( answers.generate_answers ).to_not receive( :only_host_with_role )
141
- end
142
-
143
- end
144
-
145
- describe Version34 do
146
- let( :options ) { Beaker::Options::Presets.new.presets }
147
- let( :basic_hosts ) { make_hosts( {'pe_ver' => @ver } ) }
148
- let( :hosts ) { basic_hosts[0]['roles'] = ['master', 'agent']
149
- basic_hosts[0][:custom_answers] = { :q_custom => 'LOOKYHERE' }
150
- basic_hosts[1]['roles'] = ['dashboard', 'agent']
151
- basic_hosts[2]['roles'] = ['database', 'agent']
152
- basic_hosts }
153
- let( :answers ) { Beaker::Answers.create(@ver, hosts, options) }
154
-
155
- before :each do
156
- @ver = '3.4'
157
- @answers = answers.answers
158
- end
159
-
160
- it 'should add console services answers to dashboard answers' do
161
- @ver = '3.4'
162
- answers = @answers
163
- expect( @answers['vm2'] ).to include :q_classifier_database_user => 'DFGhjlkj'
164
- expect( @answers['vm2'] ).to include :q_classifier_database_name => 'pe-classifier'
165
- expect( @answers['vm2'] ).to include :q_classifier_database_password => "'~!@\#$%^*-/ aZ'"
166
- expect( @answers['vm2'] ).to include :q_activity_database_user => 'adsfglkj'
167
- expect( @answers['vm2'] ).to include :q_activity_database_name => 'pe-activity'
168
- expect( @answers['vm2'] ).to include :q_activity_database_password => "'~!@\#$%^*-/ aZ'"
169
- expect( @answers['vm2'] ).to include :q_rbac_database_user => 'RbhNBklm'
170
- expect( @answers['vm2'] ).to include :q_rbac_database_name => 'pe-rbac'
171
- expect( @answers['vm2'] ).to include :q_rbac_database_password => "'~!@\#$%^*-/ aZ'"
172
- end
173
-
174
- it 'should add console services answers to database answers' do
175
- @ver = '3.4'
176
- answers = @answers
177
- expect( @answers['vm3'] ).to include :q_classifier_database_user => 'DFGhjlkj'
178
- expect( @answers['vm3'] ).to include :q_classifier_database_name => 'pe-classifier'
179
- expect( @answers['vm3'] ).to include :q_classifier_database_password => "'~!@\#$%^*-/ aZ'"
180
- expect( @answers['vm3'] ).to include :q_activity_database_user => 'adsfglkj'
181
- expect( @answers['vm3'] ).to include :q_activity_database_name => 'pe-activity'
182
- expect( @answers['vm3'] ).to include :q_activity_database_password => "'~!@\#$%^*-/ aZ'"
183
- expect( @answers['vm3'] ).to include :q_rbac_database_user => 'RbhNBklm'
184
- expect( @answers['vm3'] ).to include :q_rbac_database_name => 'pe-rbac'
185
- expect( @answers['vm3'] ).to include :q_rbac_database_password => "'~!@\#$%^*-/ aZ'"
186
- end
187
-
188
- it 'should add answers to the host objects' do
189
- @ver = '3.4'
190
- answers = @answers
191
- hosts.each do |host|
192
- puts "checking #{host.name}"
193
- expect( host[:answers] ).to be === answers[host.name]
194
- end
195
- end
196
-
197
- it 'should add answers to the host objects' do
198
- hosts.each do |host|
199
- expect( host[:answers] ).to be === @answers[host.name]
200
- end
201
- end
202
-
203
- it 'appends custom answers to generated answers' do
204
- expect( hosts[0][:custom_answers] ).to be == { :q_custom => 'LOOKYHERE' }
205
- expect( @answers['vm1'] ).to include :q_custom
206
- expect( hosts[0][:answers] ).to include :q_custom
207
- end
208
-
209
- end
210
-
211
- describe Version38 do
212
- let( :options ) { Beaker::Options::Presets.new.presets }
213
- let( :basic_hosts ) { make_hosts( {'pe_ver' => @ver } ) }
214
- let( :hosts ) { basic_hosts[0]['roles'] = ['master', 'agent']
215
- basic_hosts[1]['roles'] = ['dashboard', 'database', 'agent']
216
- basic_hosts[2]['roles'] = ['agent']
217
- basic_hosts[2]['platform'] = 'windows2008r2'
218
- basic_hosts }
219
- let( :answers ) { Beaker::Answers.create(@ver, hosts, options) }
220
- let( :upgrade_answers ) { Beaker::Answers.create(@ver, hosts, options.merge( {:type => :upgrade}) ) }
221
-
222
- before :each do
223
- @ver = '3.8'
224
- @answers = answers.answers
225
- end
226
-
227
- it 'should add q_pe_check_for_updates to master' do
228
- expect( @answers['vm1'][:q_pe_check_for_updates] ).to be === 'n'
229
- end
230
-
231
- it 'should add q_pe_check_for_updates to dashboard' do
232
- expect( @answers['vm2'][:q_pe_check_for_updates] ).to be === 'n'
233
- end
234
-
235
- it 'adds :q_enable_future_parser to all hosts, default to "n"' do
236
- hosts.each do |host|
237
- expect( basic_hosts[0][:answers][:q_enable_future_parser] ).to be == 'n'
238
- expect( basic_hosts[1][:answers][:q_enable_future_parser] ).to be == 'n'
239
- end
240
- end
241
-
242
- it 'adds :q_exit_for_nc_migrate to all hosts, default to "n"' do
243
- expect( basic_hosts[0][:answers][:q_exit_for_nc_migrate] ).to be == 'n'
244
- expect( basic_hosts[1][:answers][:q_exit_for_nc_migrate] ).to be == 'n'
245
- end
246
-
247
- it 'should add answers to the host objects' do
248
- answers = @answers
249
- hosts.each do |host|
250
- expect( host[:answers] ).to be === @answers[host.name]
251
- end
252
- end
253
- end
254
-
255
- describe Version40 do
256
- let( :options ) { Beaker::Options::Presets.new.presets }
257
- let( :basic_hosts ) { make_hosts( {'pe_ver' => @ver } ) }
258
- let( :hosts ) { basic_hosts[0]['roles'] = ['master', 'agent']
259
- basic_hosts[1]['roles'] = ['dashboard', 'agent']
260
- basic_hosts[2]['roles'] = ['database', 'agent']
261
- basic_hosts }
262
- let( :answers ) { Beaker::Answers.create(@ver, hosts, options) }
263
- let( :upgrade_answers ) { Beaker::Answers.create(@ver, hosts, options.merge( {:type => :upgrade}) ) }
264
-
265
- before :each do
266
- @ver = '3.99'
267
- @answers = answers.answers
268
- end
269
-
270
- it 'should not have q_puppet_cloud_install key' do
271
- hosts.each do |host|
272
- expect( host[:answers] ).to_not include :q_puppet_cloud_install
273
- end
274
- end
275
-
276
- it 'should add q_pe_check_for_updates to master' do
277
- expect( @answers['vm1'][:q_pe_check_for_updates] ).to be === 'n'
278
- end
279
-
280
- it 'should add q_pe_check_for_updates to dashboard' do
281
- expect( @answers['vm2'][:q_pe_check_for_updates] ).to be === 'n'
282
- end
283
-
284
- it 'should not add q_pe_check_for_updates to agent/database' do
285
- expect( @answers['vm3']).to_not include :q_pe_check_for_updates
286
- end
287
-
288
- # re-enable these tests once these keys are eliminated
289
- #
290
- # it 'should not have q_puppet_enterpriseconsole_database_name key' do
291
- # hosts.each do |host|
292
- # expect( host[:answers] ).to_not include :q_puppet_enterpriseconsole_database_name
293
- # end
294
- # end
295
- #
296
- # it 'should not have q_puppet_enterpriseconsole_database_password key' do
297
- # hosts.each do |host|
298
- # expect( host[:answers] ).to_not include :q_puppet_enterpriseconsole_database_password
299
- # end
300
- # end
301
- #
302
- # it 'should not have q_puppet_enterpriseconsole_database_user key' do
303
- # hosts.each do |host|
304
- # expect( host[:answers] ).to_not include :q_puppet_enterpriseconsole_database_user
305
- # end
306
- # end
307
-
308
- it ':q_update_server_host should default to the master' do
309
- hosts.each do |host|
310
- expect( host[:answers][:q_update_server_host] ).to be == hosts[0].to_s
311
- end
312
- end
313
-
314
- it 'only the master should have :q_install_update_server' do
315
- hosts.each do |host|
316
- if host[:roles].include? 'master'
317
- expect( host[:answers][:q_install_update_server] ).to be == 'y'
318
- else
319
- expect( host[:answers] ).to_not include :q_install_update_server
320
- end
321
- end
322
- end
323
-
324
- it 'should add answers to the host objects' do
325
- hosts.each do |host|
326
- expect( host[:answers] ).to be === @answers[host.name]
327
- end
328
- end
329
- end
330
-
331
- describe Version32 do
332
- let( :options ) { Beaker::Options::Presets.new.presets }
333
- let( :basic_hosts ) { make_hosts( {'pe_ver' => @ver } ) }
334
- let( :hosts ) { basic_hosts[0]['roles'] = ['master', 'agent']
335
- basic_hosts[1]['roles'] = ['dashboard', 'agent']
336
- basic_hosts[2]['roles'] = ['database', 'agent']
337
- basic_hosts }
338
- let( :answers ) { Beaker::Answers.create(@ver, hosts, options) }
339
- let( :upgrade_answers ) { Beaker::Answers.create(@ver, hosts, options.merge( {:type => :upgrade}) ) }
340
-
341
- before :each do
342
- @ver = '3.2'
343
- @answers = answers.answers
344
- end
345
-
346
- it 'should add q_pe_check_for_updates to master' do
347
- expect( @answers['vm1'][:q_pe_check_for_updates] ).to be === 'n'
348
- end
349
-
350
- it 'should add q_pe_check_for_updates to dashboard' do
351
- expect( @answers['vm2'][:q_pe_check_for_updates] ).to be === 'n'
352
- end
353
-
354
- it 'should not add q_pe_check_for_updates to agent/database' do
355
- expect( @answers['vm3']).to_not include :q_pe_check_for_updates
356
- end
357
-
358
- # The only difference between 3.2 and 3.0 is the addition of the
359
- # master certname to the dashboard answers
360
- it 'should add q_puppetmaster_certname to the dashboard answers' do
361
- expect( @answers['vm2']).to include :q_puppetmaster_certname
362
- end
363
-
364
- it 'should add q_upgrade_with_unknown_disk_space to the dashboard on upgrade' do
365
- @upgrade_answers = upgrade_answers.answers
366
- expect( @upgrade_answers['vm2']).to include :q_upgrade_with_unknown_disk_space
367
- end
368
-
369
- it 'should add answers to the host objects' do
370
- hosts.each do |host|
371
- expect( host[:answers] ).to be === @answers[host.name]
372
- end
373
- end
374
- end
375
-
376
- describe Version30 do
377
- let( :options ) { Beaker::Options::Presets.new.presets }
378
- let( :basic_hosts ) { make_hosts( { 'pe_ver' => @ver } ) }
379
- let( :hosts ) { basic_hosts[0]['roles'] = ['master', 'database', 'dashboard']
380
- basic_hosts[1]['platform'] = 'windows'
381
- basic_hosts[2][:custom_answers] = { :q_custom => 'LOOKLOOKLOOK' }
382
- basic_hosts }
383
- let( :answers ) { Beaker::Answers.create(@ver, hosts, options) }
384
- let( :upgrade_answers ) { Beaker::Answers.create(@ver, hosts, options.merge( {:type => :upgrade}) ) }
385
-
386
- before :each do
387
- @ver = '3.0'
388
- @answers = answers.answers
389
- end
390
-
391
- it 'uses simple answers for upgrade from 3.0.x to 3.0.x' do
392
- @upgrade_answers = upgrade_answers.answers
393
- expect( @upgrade_answers ).to be === { "vm2"=>{ :q_install=>"y", :q_install_vendor_packages=>"y" }, "vm1"=>{ :q_install=>"y", :q_install_vendor_packages=>"y" }, "vm3"=>{ :q_install=>"y", :q_install_vendor_packages=>"y", :q_custom=>"LOOKLOOKLOOK" } }
394
- end
395
-
396
- it 'sets correct answers for an agent' do
397
- @ver = '3.0'
398
- expect( @answers['vm3'] ).to be === { :q_install=>"y", :q_vendor_packages_install=>"y", :q_puppetagent_install=>"y", :q_puppet_cloud_install=>"y", :q_verify_packages=>"y", :q_puppet_symlinks_install=>"y", :q_puppetagent_certname=>hosts[2].to_s, :q_puppetagent_server=>hosts[0].to_s, :q_puppetmaster_install=>"n", :q_all_in_one_install=>"n", :q_puppet_enterpriseconsole_install=>"n", :q_puppetdb_install=>"n", :q_database_install=>"n", :q_custom=>"LOOKLOOKLOOK" }
399
- end
400
-
401
- it 'sets correct answers for a master' do
402
- @ver = '3.0'
403
- expect( @answers['vm1'] ).to be === { :q_install=>"y", :q_vendor_packages_install=>"y", :q_puppetagent_install=>"y", :q_puppet_cloud_install=>"y", :q_verify_packages=>"y", :q_puppet_symlinks_install=>"y", :q_puppetagent_certname=>hosts[0].to_s, :q_puppetagent_server=>hosts[0].to_s, :q_puppetmaster_install=>"y", :q_all_in_one_install=>"y", :q_puppet_enterpriseconsole_install=>"y", :q_puppetdb_install=>"y", :q_database_install=>"y", :q_puppetdb_hostname=>hosts[0].to_s, :q_puppetdb_port=>8081, :q_puppetmaster_dnsaltnames=>"#{hosts[0].to_s},#{hosts[0][:ip]},puppet", :q_puppetmaster_enterpriseconsole_hostname=>hosts[0].to_s, :q_puppetmaster_enterpriseconsole_port=>443, :q_puppetmaster_certname=>hosts[0].to_s, :q_puppetdb_database_name=>"pe-puppetdb", :q_puppetdb_database_user=>"mYpdBu3r", :q_puppetdb_database_password=>"'~!@\#$%^*-/ aZ'", :q_puppet_enterpriseconsole_auth_database_name=>"console_auth", :q_puppet_enterpriseconsole_auth_database_user=>"mYu7hu3r", :q_puppet_enterpriseconsole_auth_database_password=>"'~!@\#$%^*-/ aZ'", :q_puppet_enterpriseconsole_database_name=>"console", :q_puppet_enterpriseconsole_database_user=>"mYc0nS03u3r", :q_puppet_enterpriseconsole_database_password=>"'~!@\#$%^*-/ aZ'", :q_database_host=>hosts[0].to_s, :q_database_port=>5432, :q_pe_database=>"y", :q_puppet_enterpriseconsole_inventory_hostname=>hosts[0].to_s, :q_puppet_enterpriseconsole_inventory_certname=>hosts[0].to_s, :q_puppet_enterpriseconsole_inventory_dnsaltnames=>hosts[0].to_s, :q_puppet_enterpriseconsole_inventory_port=>8140, :q_puppet_enterpriseconsole_master_hostname=>hosts[0].to_s, :q_puppet_enterpriseconsole_auth_user_email=>"'admin@example.com'", :q_puppet_enterpriseconsole_auth_password=>"'~!@\#$%^*-/ aZ'", :q_puppet_enterpriseconsole_httpd_port=>443, :q_puppet_enterpriseconsole_smtp_host=>"'vm1'", :q_puppet_enterpriseconsole_smtp_use_tls=>"'n'", :q_puppet_enterpriseconsole_smtp_port=>"'25'", :q_database_root_password=>"'=ZYdjiP3jCwV5eo9s1MBd'", :q_database_root_user=>"pe-postgres" }
404
- end
405
-
406
- it 'generates nil answers for a windows host' do
407
- @ver = '3.0'
408
- expect( @answers['vm2'] ).to be === nil
409
- end
410
-
411
- it 'should add answers to the host objects' do
412
- @ver = '3.0'
413
- a = answers.answers
414
- hosts.each do |host|
415
- expect( host[:answers] ).to be === @answers[host.name]
416
- end
417
- end
418
-
419
- it 'appends custom answers to generated answers' do
420
- expect( hosts[2][:custom_answers] ).to be == { :q_custom => 'LOOKLOOKLOOK' }
421
- expect( @answers['vm3'] ).to include :q_custom
422
- expect( hosts[2][:answers] ).to include :q_custom
423
- end
424
- end
425
-
426
- describe Version28 do
427
- let( :options ) { Beaker::Options::Presets.new.presets }
428
- let( :basic_hosts ) { make_hosts( { 'pe_ver' => @ver } ) }
429
- let( :hosts ) { basic_hosts[0]['roles'] = ['master', 'database', 'dashboard']
430
- basic_hosts[1]['platform'] = 'windows'
431
- basic_hosts }
432
- let( :answers ) { Beaker::Answers.create(@ver, hosts, options) }
433
-
434
- before :each do
435
- @ver = '2.8'
436
- @answers = answers.answers
437
- end
438
-
439
- it 'sets correct answers for an agent' do
440
- expect( @answers['vm3'] ).to be === { :q_install=>"y", :q_puppetagent_install=>"y", :q_puppet_cloud_install=>"y", :q_puppet_symlinks_install=>"y", :q_vendor_packages_install=>"y", :q_puppetagent_certname=>hosts[2].to_s, :q_puppetagent_server=>hosts[0].to_s, :q_puppetmaster_install=>"n", :q_puppet_enterpriseconsole_install=>"n" }
441
- end
442
-
443
- it 'sets correct answers for a master' do
444
- expect( @answers['vm1'] ).to be === { :q_install=>"y", :q_puppetagent_install=>"y", :q_puppet_cloud_install=>"y", :q_puppet_symlinks_install=>"y", :q_vendor_packages_install=>"y", :q_puppetagent_certname=>hosts[0].to_s, :q_puppetagent_server=>hosts[0].to_s, :q_puppetmaster_install=>"y", :q_puppet_enterpriseconsole_install=>"y", :q_puppetmaster_certname=>hosts[0].to_s, :q_puppetmaster_dnsaltnames=>"#{hosts[0].to_s},#{hosts[0][:ip]},puppet", :q_puppetmaster_enterpriseconsole_hostname=>hosts[0].to_s, :q_puppetmaster_enterpriseconsole_port=>443, :q_puppetmaster_forward_facts=>"y", :q_puppet_enterpriseconsole_database_install=>"y", :q_puppet_enterpriseconsole_auth_database_name=>"console_auth", :q_puppet_enterpriseconsole_auth_database_user=>"mYu7hu3r", :q_puppet_enterpriseconsole_auth_database_password=>"'~!@\#$%^*-/ aZ'", :q_puppet_enterpriseconsole_database_name=>"console", :q_puppet_enterpriseconsole_database_user=>"mYc0nS03u3r", :q_puppet_enterpriseconsole_database_password=>"'~!@\#$%^*-/ aZ'", :q_puppet_enterpriseconsole_inventory_hostname=>hosts[0].to_s, :q_puppet_enterpriseconsole_inventory_certname=>hosts[0].to_s, :q_puppet_enterpriseconsole_inventory_dnsaltnames=>hosts[0].to_s, :q_puppet_enterpriseconsole_inventory_port=>8140, :q_puppet_enterpriseconsole_master_hostname=>hosts[0].to_s, :q_puppet_enterpriseconsole_auth_user_email=>"'admin@example.com'", :q_puppet_enterpriseconsole_auth_password=>"'~!@\#$%^*-/ aZ'", :q_puppet_enterpriseconsole_httpd_port=>443, :q_puppet_enterpriseconsole_smtp_host=>"'vm1'", :q_puppet_enterpriseconsole_smtp_use_tls=>"'n'", :q_puppet_enterpriseconsole_smtp_port=>"'25'", :q_puppet_enterpriseconsole_auth_user=>"'admin@example.com'" }
445
- end
446
-
447
- it 'generates nil answers for a windows host' do
448
- expect( @answers['vm2'] ).to be === nil
449
- end
450
-
451
- it 'should add answers to the host objects' do
452
- hosts.each do |host|
453
- expect( host[:answers] ).to be === @answers[host.name]
454
- end
455
- end
456
-
457
- end
458
- describe Version20 do
459
- let( :options ) { Beaker::Options::Presets.new.presets }
460
- let( :basic_hosts ) { make_hosts( { 'pe_ver' => @ver } ) }
461
- let( :hosts ) { basic_hosts[0]['roles'] = ['master', 'database', 'dashboard']
462
- basic_hosts[1]['platform'] = 'windows'
463
- basic_hosts }
464
-
465
- let( :answers ) { Beaker::Answers.create(@ver, hosts, options) }
466
-
467
- before :each do
468
- @ver = '2.0'
469
- @answers = answers.answers
470
- end
471
-
472
- it 'sets correct answers for an agent' do
473
- expect( @answers['vm3'] ).to be === { :q_install=>"y", :q_puppetagent_install=>"y", :q_puppet_cloud_install=>"y", :q_puppet_symlinks_install=>"y", :q_vendor_packages_install=>"y", :q_puppetagent_certname=>hosts[2].to_s, :q_puppetagent_server=>hosts[0].to_s, :q_puppetmaster_install=>"n", :q_puppet_enterpriseconsole_install=>"n" }
474
- end
475
-
476
- it 'sets correct answers for a master' do
477
- expect( @answers['vm1'] ).to be === { :q_install=>"y", :q_puppetagent_install=>"y", :q_puppet_cloud_install=>"y", :q_puppet_symlinks_install=>"y", :q_vendor_packages_install=>"y", :q_puppetagent_certname=>hosts[0].to_s, :q_puppetagent_server=>hosts[0].to_s, :q_puppetmaster_install=>"y", :q_puppet_enterpriseconsole_install=>"y", :q_puppetmaster_certname=>hosts[0].to_s, :q_puppetmaster_dnsaltnames=>"#{hosts[0].to_s},#{hosts[0][:ip]},puppet", :q_puppetmaster_enterpriseconsole_hostname=>hosts[0].to_s, :q_puppetmaster_enterpriseconsole_port=>443, :q_puppetmaster_forward_facts=>"y", :q_puppet_enterpriseconsole_database_install=>"y", :q_puppet_enterpriseconsole_auth_database_name=>"console_auth", :q_puppet_enterpriseconsole_auth_database_user=>"mYu7hu3r", :q_puppet_enterpriseconsole_auth_database_password=>"'~!@\#$%^*-/ aZ'", :q_puppet_enterpriseconsole_database_name=>"console", :q_puppet_enterpriseconsole_database_user=>"mYc0nS03u3r", :q_puppet_enterpriseconsole_database_root_password=>"'~!@\#$%^*-/ aZ'", :q_puppet_enterpriseconsole_database_password=>"'~!@\#$%^*-/ aZ'", :q_puppet_enterpriseconsole_inventory_hostname=>hosts[0].to_s, :q_puppet_enterpriseconsole_inventory_certname=>hosts[0].to_s, :q_puppet_enterpriseconsole_inventory_dnsaltnames=>hosts[0].to_s, :q_puppet_enterpriseconsole_inventory_port=>8140, :q_puppet_enterpriseconsole_master_hostname=>hosts[0].to_s, :q_puppet_enterpriseconsole_auth_user_email=>"'admin@example.com'", :q_puppet_enterpriseconsole_auth_password=>"'~!@\#$%^*-/ aZ'", :q_puppet_enterpriseconsole_httpd_port=>443, :q_puppet_enterpriseconsole_smtp_host=>"'vm1'", :q_puppet_enterpriseconsole_smtp_use_tls=>"'n'", :q_puppet_enterpriseconsole_smtp_port=>"'25'", :q_puppet_enterpriseconsole_auth_user=>"'admin@example.com'" }
478
- end
479
-
480
- it 'generates nil answers for a windows host' do
481
- expect( @answers['vm2'] ).to be === nil
482
- end
483
-
484
- it 'should add answers to the host objects' do
485
- hosts.each do |host|
486
- expect( host[:answers] ).to be === @answers[host.name]
487
- end
488
- end
489
- end
490
-
491
- describe 'Customization' do
492
- let( :basic_hosts ) { make_hosts( { 'pe_ver' => @ver } ) }
493
- let( :options ) { Beaker::Options::Presets.new.presets }
494
- let( :hosts ) { basic_hosts[0]['roles'] = ['master', 'database', 'dashboard']
495
- basic_hosts[1]['platform'] = 'windows'
496
- basic_hosts }
497
- let( :answers ) { Beaker::Answers.create(@ver, hosts, options) }
498
-
499
- def test_answer_customization(answer_key, value_to_set)
500
- @ver = '3.0'
501
- options[:answers] ||= Beaker::Options::OptionsHash.new
502
- options[:answers][answer_key] = value_to_set
503
- host_answers = answers.answers['vm1']
504
- expect( host_answers[answer_key] ).to be === value_to_set
505
- end
506
-
507
- it 'sets :q_puppetdb_hostname' do
508
- test_answer_customization(:q_puppetdb_hostname, 'q_puppetdb_hostname_custom01')
509
- end
510
-
511
- it 'sets :q_puppetdb_database_user' do
512
- test_answer_customization(:q_puppetdb_database_user, 'q_puppetdb_database_user_custom02')
513
- end
514
-
515
- it 'sets :q_puppetdb_database_password' do
516
- test_answer_customization(:q_puppetdb_database_password, 'q_puppetdb_database_password_custom03')
517
- end
518
-
519
- it 'sets :q_puppet_enterpriseconsole_auth_database_password' do
520
- answer = 'q_puppet_enterpriseconsole_auth_database_password_custom04'
521
- test_answer_customization(:q_puppet_enterpriseconsole_auth_database_password, answer)
522
- end
523
-
524
- it 'sets :q_puppet_enterpriseconsole_database_user' do
525
- answer = 'q_puppet_enterpriseconsole_database_user_custom05'
526
- test_answer_customization(:q_puppet_enterpriseconsole_database_user, answer)
527
- end
528
-
529
- it 'sets :q_puppet_enterpriseconsole_database_password' do
530
- answer = 'q_puppet_enterpriseconsole_database_password_custom06'
531
- test_answer_customization(:q_puppet_enterpriseconsole_database_password, answer)
532
- end
533
-
534
- it 'sets :q_database_host' do
535
- test_answer_customization(:q_database_host, 'q_database_host_custom07')
536
- end
537
-
538
- it 'sets :q_database_install' do
539
- test_answer_customization(:q_database_install, 'q_database_install_custom08')
540
- end
541
-
542
- it 'sets :q_pe_database' do
543
- test_answer_customization(:q_pe_database, 'q_pe_database_custom08')
544
- end
545
-
546
- end
547
- end