beaker 2.13.0 → 2.14.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 (62) hide show
  1. checksums.yaml +8 -8
  2. data/Gemfile +19 -0
  3. data/HISTORY.md +335 -2
  4. data/acceptance/pre_suite/puppet_git/install.rb +2 -2
  5. data/lib/beaker/answers.rb +45 -2
  6. data/lib/beaker/answers/version20.rb +9 -9
  7. data/lib/beaker/answers/version28.rb +9 -9
  8. data/lib/beaker/answers/version30.rb +19 -19
  9. data/lib/beaker/answers/version32.rb +1 -1
  10. data/lib/beaker/answers/version34.rb +4 -4
  11. data/lib/beaker/answers/version40.rb +1 -1
  12. data/lib/beaker/cli.rb +11 -4
  13. data/lib/beaker/command.rb +4 -2
  14. data/lib/beaker/command_factory.rb +5 -1
  15. data/lib/beaker/dsl/helpers/host_helpers.rb +17 -5
  16. data/lib/beaker/dsl/install_utils.rb +3 -2
  17. data/lib/beaker/dsl/install_utils/aio_defaults.rb +86 -0
  18. data/lib/beaker/dsl/install_utils/foss_defaults.rb +163 -0
  19. data/lib/beaker/dsl/install_utils/foss_utils.rb +988 -0
  20. data/lib/beaker/dsl/install_utils/pe_defaults.rb +139 -0
  21. data/lib/beaker/dsl/install_utils/pe_utils.rb +140 -38
  22. data/lib/beaker/dsl/install_utils/puppet_utils.rb +26 -751
  23. data/lib/beaker/dsl/structure.rb +7 -1
  24. data/lib/beaker/host.rb +35 -58
  25. data/lib/beaker/host/freebsd.rb +4 -16
  26. data/lib/beaker/host/mac.rb +3 -39
  27. data/lib/beaker/host/mac/pkg.rb +2 -1
  28. data/lib/beaker/host/pswindows.rb +2 -28
  29. data/lib/beaker/host/unix.rb +3 -51
  30. data/lib/beaker/host/unix/pkg.rb +34 -33
  31. data/lib/beaker/host/windows.rb +1 -45
  32. data/lib/beaker/host_prebuilt_steps.rb +11 -24
  33. data/lib/beaker/hypervisor/aixer.rb +1 -1
  34. data/lib/beaker/hypervisor/docker.rb +43 -4
  35. data/lib/beaker/hypervisor/openstack.rb +1 -0
  36. data/lib/beaker/hypervisor/solaris.rb +1 -1
  37. data/lib/beaker/hypervisor/vmpooler.rb +19 -8
  38. data/lib/beaker/network_manager.rb +5 -4
  39. data/lib/beaker/options/command_line_parser.rb +9 -9
  40. data/lib/beaker/options/parser.rb +21 -17
  41. data/lib/beaker/options/presets.rb +0 -33
  42. data/lib/beaker/platform.rb +7 -3
  43. data/lib/beaker/ssh_connection.rb +1 -1
  44. data/lib/beaker/version.rb +1 -1
  45. data/spec/beaker/answers_spec.rb +13 -8
  46. data/spec/beaker/cli_spec.rb +6 -6
  47. data/spec/beaker/command_spec.rb +18 -0
  48. data/spec/beaker/dsl/helpers/puppet_helpers_spec.rb +2 -0
  49. data/spec/beaker/dsl/install_utils/{puppet_utils_spec.rb → foss_utils_spec.rb} +34 -21
  50. data/spec/beaker/dsl/install_utils/pe_utils_spec.rb +2 -0
  51. data/spec/beaker/dsl/structure_spec.rb +8 -0
  52. data/spec/beaker/host/unix/pkg_spec.rb +15 -10
  53. data/spec/beaker/host_prebuilt_steps_spec.rb +1 -1
  54. data/spec/beaker/host_spec.rb +3 -54
  55. data/spec/beaker/hypervisor/docker_spec.rb +2 -0
  56. data/spec/beaker/hypervisor/vmpooler_spec.rb +67 -10
  57. data/spec/beaker/options/command_line_parser_spec.rb +2 -2
  58. data/spec/beaker/options/parser_spec.rb +35 -24
  59. data/spec/beaker/options/presets_spec.rb +0 -26
  60. data/spec/helpers.rb +5 -5
  61. data/spec/mocks.rb +1 -2
  62. metadata +7 -3
@@ -3,14 +3,18 @@ module Beaker
3
3
  # all String methods while adding several platform-specific use cases.
4
4
  class Platform < String
5
5
  # Supported platforms
6
- PLATFORMS = /^(freebsd|osx|centos|fedora|debian|oracle|redhat|scientific|sles|ubuntu|windows|solaris|aix|el|eos|cumulus)\-.+\-.+$/
6
+ PLATFORMS = /^(cisco|freebsd|osx|centos|fedora|debian|oracle|redhat|scientific|sles|ubuntu|windows|solaris|aix|el|eos|cumulus)\-.+\-.+$/
7
7
 
8
8
  # Platform version numbers vs. codenames conversion hash
9
9
  PLATFORM_VERSION_CODES =
10
- { :debian => { "wheezy" => "7",
10
+ { :debian => { "jessie" => "8",
11
+ "wheezy" => "7",
11
12
  "squeeze" => "6",
12
13
  },
13
- :ubuntu => { "trusty" => "1404",
14
+ :ubuntu => { "wily" => "1510",
15
+ "vivid" => "1504",
16
+ "utopic" => "1410",
17
+ "trusty" => "1404",
14
18
  "saucy" => "1310",
15
19
  "raring" => "1304",
16
20
  "quantal" => "1210",
@@ -171,7 +171,7 @@ module Beaker
171
171
  def request_terminal_for channel, command
172
172
  channel.request_pty do |ch, success|
173
173
  if success
174
- @logger.info "Allocated a PTY on #{@hostname} for #{command.inspect}"
174
+ @logger.debug "Allocated a PTY on #{@hostname} for #{command.inspect}"
175
175
  else
176
176
  abort "FAILED: could not allocate a pty when requested on " +
177
177
  "#{@hostname} for #{command.inspect}"
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '2.13.0'
3
+ STRING = '2.14.0'
4
4
  end
5
5
  end
@@ -150,6 +150,7 @@ module Beaker
150
150
  @ver = '3.4'
151
151
  answers = @answers
152
152
  hosts.each do |host|
153
+ puts "checking #{host.name}"
153
154
  expect( host[:answers] ).to be === answers[host.name]
154
155
  end
155
156
  end
@@ -205,8 +206,9 @@ module Beaker
205
206
  end
206
207
 
207
208
  it 'should add answers to the host objects' do
209
+ answers = @answers
208
210
  hosts.each do |host|
209
- expect( host[:answers] ).to be === @answers[host.name]
211
+ expect( host[:answers] ).to be === answers[host.name]
210
212
  end
211
213
  end
212
214
  end
@@ -266,7 +268,7 @@ module Beaker
266
268
 
267
269
  it ':q_update_server_host should default to the master' do
268
270
  hosts.each do |host|
269
- expect( host[:answers][:q_update_server_host] ).to be == hosts[0]
271
+ expect( host[:answers][:q_update_server_host] ).to be == hosts[0].to_s
270
272
  end
271
273
  end
272
274
 
@@ -354,12 +356,12 @@ module Beaker
354
356
 
355
357
  it 'sets correct answers for an agent' do
356
358
  @ver = '3.0'
357
- 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], :q_puppetagent_server=>hosts[0], :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" }
359
+ 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" }
358
360
  end
359
361
 
360
362
  it 'sets correct answers for a master' do
361
363
  @ver = '3.0'
362
- 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], :q_puppetagent_server=>hosts[0], :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], :q_puppetdb_port=>8081, :q_puppetmaster_dnsaltnames=>"#{hosts[0]},#{hosts[0][:ip]},puppet", :q_puppetmaster_enterpriseconsole_hostname=>hosts[0], :q_puppetmaster_enterpriseconsole_port=>443, :q_puppetmaster_certname=>hosts[0], :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], :q_database_port=>5432, :q_pe_database=>"y", :q_puppet_enterpriseconsole_inventory_hostname=>hosts[0], :q_puppet_enterpriseconsole_inventory_certname=>hosts[0], :q_puppet_enterpriseconsole_inventory_dnsaltnames=>hosts[0], :q_puppet_enterpriseconsole_inventory_port=>8140, :q_puppet_enterpriseconsole_master_hostname=>hosts[0], :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" }
364
+ 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" }
363
365
  end
364
366
 
365
367
  it 'generates nil answers for a windows host' do
@@ -396,11 +398,11 @@ module Beaker
396
398
  end
397
399
 
398
400
  it 'sets correct answers for an agent' do
399
- 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], :q_puppetagent_server=>hosts[0], :q_puppetmaster_install=>"n", :q_puppet_enterpriseconsole_install=>"n" }
401
+ 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" }
400
402
  end
401
403
 
402
404
  it 'sets correct answers for a master' do
403
- 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], :q_puppetagent_server=>hosts[0], :q_puppetmaster_install=>"y", :q_puppet_enterpriseconsole_install=>"y", :q_puppetmaster_certname=>hosts[0], :q_puppetmaster_dnsaltnames=>"#{hosts[0]},#{hosts[0][:ip]},puppet", :q_puppetmaster_enterpriseconsole_hostname=>hosts[0], :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], :q_puppet_enterpriseconsole_inventory_certname=>hosts[0], :q_puppet_enterpriseconsole_inventory_dnsaltnames=>hosts[0], :q_puppet_enterpriseconsole_inventory_port=>8140, :q_puppet_enterpriseconsole_master_hostname=>hosts[0], :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'" }
405
+ 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'" }
404
406
  end
405
407
 
406
408
  it 'generates nil answers for a windows host' do
@@ -429,11 +431,11 @@ module Beaker
429
431
  end
430
432
 
431
433
  it 'sets correct answers for an agent' do
432
- 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], :q_puppetagent_server=>hosts[0], :q_puppetmaster_install=>"n", :q_puppet_enterpriseconsole_install=>"n" }
434
+ 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" }
433
435
  end
434
436
 
435
437
  it 'sets correct answers for a master' do
436
- 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], :q_puppetagent_server=>hosts[0], :q_puppetmaster_install=>"y", :q_puppet_enterpriseconsole_install=>"y", :q_puppetmaster_certname=>hosts[0], :q_puppetmaster_dnsaltnames=>"#{hosts[0]},#{hosts[0][:ip]},puppet", :q_puppetmaster_enterpriseconsole_hostname=>hosts[0], :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], :q_puppet_enterpriseconsole_inventory_certname=>hosts[0], :q_puppet_enterpriseconsole_inventory_dnsaltnames=>hosts[0], :q_puppet_enterpriseconsole_inventory_port=>8140, :q_puppet_enterpriseconsole_master_hostname=>hosts[0], :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'" }
438
+ 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'" }
437
439
  end
438
440
 
439
441
  it 'generates nil answers for a windows host' do
@@ -457,6 +459,9 @@ module Beaker
457
459
 
458
460
  def test_answer_customization(answer_key, value_to_set)
459
461
  @ver = '3.0'
462
+ if not options[:answers]
463
+ options[:answers] = {}
464
+ end
460
465
  options[:answers][answer_key] = value_to_set
461
466
  host_answers = answers.answers['vm1']
462
467
  expect( host_answers[answer_key] ).to be === value_to_set
@@ -203,8 +203,8 @@ module Beaker
203
203
  options[:hosts_file] = 'sample.cfg'
204
204
 
205
205
  hosts = [
206
- { :hypervisor => 'peterPan' },
207
- { :hypervisor => 'theMadHatter' },
206
+ make_host('petey', { :hypervisor => 'peterPan' }),
207
+ make_host('hatty', { :hypervisor => 'theMadHatter' }),
208
208
  ]
209
209
  cli.instance_variable_set(:@hosts, hosts)
210
210
 
@@ -303,7 +303,7 @@ module Beaker
303
303
  copied_hosts_file = File.join(File.absolute_path(dir), options[:hosts_file])
304
304
 
305
305
  hosts = cli.instance_variable_get(:@hosts)
306
- hosts << { :hypervisor => 'fusion' }
306
+ hosts << make_host('fusion', { :hypervisor => 'fusion' })
307
307
 
308
308
  reproducing_cmd = "the faith of the people"
309
309
  allow( cli ).to receive( :build_hosts_preserved_reproducing_command ).and_return( reproducing_cmd )
@@ -323,8 +323,8 @@ module Beaker
323
323
  copied_hosts_file = File.join(File.absolute_path(dir), options[:hosts_file])
324
324
 
325
325
  hosts = cli.instance_variable_get(:@hosts)
326
- hosts << { :hypervisor => 'fusion' }
327
- hosts << { :hypervisor => 'docker' }
326
+ hosts << make_host('fusion', { :hypervisor => 'fusion' })
327
+ hosts << make_host('docker', { :hypervisor => 'docker' })
328
328
 
329
329
  reproducing_cmd = "the crow flies true says the shoe to you"
330
330
  allow( cli ).to receive( :build_hosts_preserved_reproducing_command ).and_return( reproducing_cmd )
@@ -345,7 +345,7 @@ module Beaker
345
345
  copied_hosts_file = File.join(File.absolute_path(dir), options[:hosts_file])
346
346
 
347
347
  hosts = cli.instance_variable_get(:@hosts)
348
- hosts << { :hypervisor => 'docker' }
348
+ hosts << make_host('docker', { :hypervisor => 'docker' })
349
349
 
350
350
  logger = cli.instance_variable_get(:@logger)
351
351
  expect( logger ).to receive( :send ).with( anything, "\nYou can re-run commands against the already provisioned SUT(s) with:\n").never
@@ -23,6 +23,24 @@ module Beaker
23
23
 
24
24
  end
25
25
 
26
+ describe '#:prepend_cmds' do
27
+ it 'can prepend commands' do
28
+ @command = '/usr/bin/blah'
29
+ @args = [ 'to', 'the', 'baz' ]
30
+ @options = { :foo => 'bar', :prepend_cmds => 'aloha!' }
31
+
32
+ expect( cmd.cmd_line({}) ).to be == "aloha! /usr/bin/blah --foo=bar to the baz"
33
+ end
34
+
35
+ it 'can handle no prepend_cmds' do
36
+ @command = '/usr/bin/blah'
37
+ @args = [ 'to', 'the', 'baz' ]
38
+ @options = { :foo => 'bar', :prepend_cmds => nil }
39
+
40
+ expect( cmd.cmd_line({}) ).to be == "/usr/bin/blah --foo=bar to the baz"
41
+ end
42
+ end
43
+
26
44
  describe '#options_string' do
27
45
  it 'parses things' do
28
46
  subject.options = { :v => nil, :test => nil,
@@ -540,6 +540,7 @@ describe ClassMixedWithDSLHelpers do
540
540
 
541
541
  describe 'and command line args passed' do
542
542
  it 'modifies SUT trapperkeeper configuration w/ command line args' do
543
+ host['puppetserver-confdir'] = '/etc/puppetserver/conf.d'
543
544
  expect( subject ).to receive( :modify_tk_config).with(host, puppetserver_conf,
544
545
  custom_puppetserver_opts)
545
546
  subject.with_puppet_running_on(host, conf_opts)
@@ -549,6 +550,7 @@ describe ClassMixedWithDSLHelpers do
549
550
  describe 'and no command line args passed' do
550
551
  let(:command_line_args) { nil }
551
552
  it 'modifies SUT trapperkeeper configuration w/ puppet defaults' do
553
+ host['puppetserver-confdir'] = '/etc/puppetserver/conf.d'
552
554
  expect( subject ).to receive( :modify_tk_config).with(host, puppetserver_conf,
553
555
  default_puppetserver_opts)
554
556
  subject.with_puppet_running_on(host, conf_opts)
@@ -133,6 +133,8 @@ describe ClassMixedWithDSLInstallUtils do
133
133
  logger = double.as_null_object
134
134
 
135
135
  allow( subject ).to receive( :metadata ).and_return( metadata )
136
+ allow( subject ).to receive( :configure_foss_defaults_on ).and_return( true )
137
+
136
138
  expect( subject ).to receive( :logger ).exactly( 3 ).times.and_return( logger )
137
139
  expect( subject ).to receive( :on ).exactly( 4 ).times
138
140
 
@@ -151,6 +153,7 @@ describe ClassMixedWithDSLInstallUtils do
151
153
  host = { 'platform' => 'debian' }
152
154
  logger = double.as_null_object
153
155
  allow( subject ).to receive( :metadata ).and_return( metadata )
156
+ allow( subject ).to receive( :configure_foss_defaults_on ).and_return( true )
154
157
  expect( subject ).to receive( :logger ).exactly( 3 ).times.and_return( logger )
155
158
  expect( subject ).to receive( :on ).with( host,"test -d #{path} || mkdir -p #{path}").exactly( 1 ).times
156
159
  # this is the the command we want to test
@@ -172,6 +175,7 @@ describe ClassMixedWithDSLInstallUtils do
172
175
  path = '/path/to/repos'
173
176
  cmd = "test -d #{path}/#{repo[:name]} || git clone --branch #{repo[:depth_branch]} --depth #{repo[:depth]} #{repo[:path]} #{path}/#{repo[:name]}"
174
177
  host = { 'platform' => 'debian' }
178
+ allow( subject ).to receive( :configure_foss_defaults_on ).and_return( true )
175
179
  logger = double.as_null_object
176
180
  allow( subject ).to receive( :metadata ).and_return( metadata )
177
181
  expect( subject ).to receive( :logger ).exactly( 3 ).times.and_return( logger )
@@ -192,65 +196,68 @@ describe ClassMixedWithDSLInstallUtils do
192
196
  end
193
197
 
194
198
  before do
199
+ allow( subject ).to receive(:options).and_return(opts)
195
200
  allow( subject ).to receive(:hosts).and_return(hosts)
196
201
  allow( subject ).to receive(:on).and_return(Beaker::Result.new({},''))
197
202
  end
198
203
  context 'on el-6' do
199
- let(:platform) { "el-6-i386" }
204
+ let(:platform) { Beaker::Platform.new('el-6-i386') }
200
205
  it 'installs' do
201
206
  expect(subject).to receive(:on).with(hosts[0], /puppetlabs-release-el-6\.noarch\.rpm/)
202
- expect(subject).to receive(:on).with(hosts[0], 'yum install -y puppet')
207
+ expect(hosts[0]).to receive(:install_package).with('puppet')
203
208
  subject.install_puppet
204
209
  end
205
210
  it 'installs specific version of puppet when passed :version' do
206
- expect(subject).to receive(:on).with(hosts[0], 'yum install -y puppet-3000')
211
+ expect(hosts[0]).to receive(:install_package).with('puppet-3000')
207
212
  subject.install_puppet( :version => '3000' )
208
213
  end
209
214
  it 'can install specific versions of puppets dependencies' do
210
- expect(subject).to receive(:on).with(hosts[0], 'yum install -y puppet-3000')
211
- expect(subject).to receive(:on).with(hosts[0], 'yum install -y hiera-2001')
212
- expect(subject).to receive(:on).with(hosts[0], 'yum install -y facter-1999')
215
+ expect(hosts[0]).to receive(:install_package).with('puppet-3000')
216
+ expect(hosts[0]).to receive(:install_package).with('hiera-2001')
217
+ expect(hosts[0]).to receive(:install_package).with('facter-1999')
213
218
  subject.install_puppet( :version => '3000', :facter_version => '1999', :hiera_version => '2001' )
214
219
  end
215
220
  end
216
221
  context 'on el-5' do
217
- let(:platform) { "el-5-i386" }
222
+ let(:platform) { Beaker::Platform.new('el-5-i386') }
218
223
  it 'installs' do
219
224
  expect(subject).to receive(:on).with(hosts[0], /puppetlabs-release-el-5\.noarch\.rpm/)
220
- expect(subject).to receive(:on).with(hosts[0], 'yum install -y puppet')
225
+ expect(hosts[0]).to receive(:install_package).with('puppet')
221
226
  subject.install_puppet
222
227
  end
223
228
  end
224
229
  context 'on fedora' do
225
- let(:platform) { "fedora-18-x86_84" }
230
+ let(:platform) { Beaker::Platform.new('fedora-18-x86_84') }
226
231
  it 'installs' do
227
232
  expect(subject).to receive(:on).with(hosts[0], /puppetlabs-release-fedora-18\.noarch\.rpm/)
228
- expect(subject).to receive(:on).with(hosts[0], 'yum install -y puppet')
233
+ expect(hosts[0]).to receive(:install_package).with('puppet')
229
234
  subject.install_puppet
230
235
  end
231
236
  end
232
237
  context 'on debian' do
233
- let(:platform) { "debian-7-amd64" }
238
+ let(:platform) { Beaker::Platform.new('debian-7-amd64') }
234
239
  it 'installs latest if given no version info' do
235
- expect(subject).to receive(:on).with(hosts[0], /puppetlabs-release-\$\(lsb_release -c -s\)\.deb/)
236
- expect(subject).to receive(:on).with(hosts[0], 'dpkg -i puppetlabs-release-$(lsb_release -c -s).deb')
237
- expect(subject).to receive(:on).with(hosts[0], 'apt-get update')
238
- expect(subject).to receive(:on).with(hosts[0], 'apt-get install -y puppet')
240
+ hosts.each do |host|
241
+ expect(subject).to receive(:install_puppetlabs_release_repo).with(host)
242
+ end
243
+ expect(hosts[0]).to receive(:install_package).with('puppet')
239
244
  subject.install_puppet
240
245
  end
241
246
  it 'installs specific version of puppet when passed :version' do
242
- expect(subject).to receive(:on).with(hosts[0], 'apt-get install -y puppet=3000-1puppetlabs1')
247
+ expect(hosts[0]).to receive(:install_package).with('puppet=3000-1puppetlabs1')
248
+ expect(hosts[0]).to receive(:install_package).with('puppet-common=3000-1puppetlabs1')
243
249
  subject.install_puppet( :version => '3000' )
244
250
  end
245
251
  it 'can install specific versions of puppets dependencies' do
246
- expect(subject).to receive(:on).with(hosts[0], 'apt-get install -y puppet=3000-1puppetlabs1')
247
- expect(subject).to receive(:on).with(hosts[0], 'apt-get install -y hiera=2001-1puppetlabs1')
248
- expect(subject).to receive(:on).with(hosts[0], 'apt-get install -y facter=1999-1puppetlabs1')
252
+ expect(hosts[0]).to receive(:install_package).with('facter=1999-1puppetlabs1')
253
+ expect(hosts[0]).to receive(:install_package).with('hiera=2001-1puppetlabs1')
254
+ expect(hosts[0]).to receive(:install_package).with('puppet-common=3000-1puppetlabs1')
255
+ expect(hosts[0]).to receive(:install_package).with('puppet=3000-1puppetlabs1')
249
256
  subject.install_puppet( :version => '3000', :facter_version => '1999', :hiera_version => '2001' )
250
257
  end
251
258
  end
252
259
  context 'on windows' do
253
- let(:platform) { "windows-2008r2-i386" }
260
+ let(:platform) { Beaker::Platform.new('windows-2008r2-i386') }
254
261
  it 'installs specific version of puppet when passed :version' do
255
262
  allow(hosts[0]).to receive(:is_cygwin?).and_return(true)
256
263
  allow(subject).to receive(:link_exists?).and_return( true )
@@ -268,7 +275,7 @@ describe ClassMixedWithDSLInstallUtils do
268
275
  end
269
276
  end
270
277
  describe 'on unsupported platforms' do
271
- let(:platform) { 'solaris-11-x86_64' }
278
+ let(:platform) { Beaker::Platform.new('solaris-11-x86_64') }
272
279
  let(:host) { make_host('henry', :platform => 'solaris-11-x86_64') }
273
280
  let(:hosts) { [host] }
274
281
  it 'by default raises an error' do
@@ -351,6 +358,7 @@ describe ClassMixedWithDSLInstallUtils do
351
358
 
352
359
  before do
353
360
  allow(subject).to receive(:options) { opts }
361
+ allow( subject ).to receive( :configure_foss_defaults_on ).and_return( true )
354
362
  end
355
363
 
356
364
  describe "When host is unsupported platform" do
@@ -396,6 +404,7 @@ describe ClassMixedWithDSLInstallUtils do
396
404
  let( :logger_double ) do
397
405
  logger_double = Object.new
398
406
  allow(logger_double).to receive(:debug)
407
+ allow( subject ).to receive( :configure_foss_defaults_on ).and_return( true )
399
408
  subject.instance_variable_set(:@logger, logger_double)
400
409
  logger_double
401
410
  end
@@ -519,6 +528,10 @@ describe ClassMixedWithDSLInstallUtils do
519
528
  FakeHost.create('fakvm', platform, opts)
520
529
  end
521
530
 
531
+ before :each do
532
+ allow( subject ).to receive( :configure_foss_defaults_on ).and_return( true )
533
+ end
534
+
522
535
  it 'sets the find command correctly for el-based systems' do
523
536
  @platform = 'el-1-3'
524
537
  expect( subject ).to receive( :on ).with( host, /\*\.rpm.+rpm\s-ivh/ )
@@ -8,6 +8,8 @@ class ClassMixedWithDSLInstallUtils
8
8
  include Beaker::DSL::Roles
9
9
  include Beaker::DSL::Patterns
10
10
 
11
+ attr_accessor :hosts
12
+
11
13
  def logger
12
14
  @logger ||= RSpec::Mocks::Double.new('logger').as_null_object
13
15
  end
@@ -128,6 +128,14 @@ describe ClassMixedWithDSLStructure do
128
128
  subject.confine( :to, {} )
129
129
  end
130
130
 
131
+ it 'uses a provided host subset when no criteria is provided' do
132
+
133
+ subset = ['host1', 'host2']
134
+ hosts = subset.dup << 'host3'
135
+ expect( subject ).to receive( :hosts= ).with( subset )
136
+ subject.confine :to, {}, subset
137
+ end
138
+
131
139
  it 'raises when given mode is not :to or :except' do
132
140
  allow( subject ).to receive( :hosts )
133
141
  allow( subject ).to receive( :hosts= )
@@ -17,6 +17,11 @@ module Beaker
17
17
  def to_s
18
18
  "me"
19
19
  end
20
+
21
+ def exec
22
+ #noop
23
+ end
24
+
20
25
  end
21
26
 
22
27
  let (:opts) { @opts || {} }
@@ -28,7 +33,7 @@ module Beaker
28
33
  it "checks correctly on sles" do
29
34
  @opts = {'platform' => 'sles-is-me'}
30
35
  pkg = 'sles_package'
31
- expect( Beaker::Command ).to receive(:new).with("zypper se -i --match-exact #{pkg}").and_return('')
36
+ expect( Beaker::Command ).to receive(:new).with("zypper se -i --match-exact #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
32
37
  expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
33
38
  expect( instance.check_for_package(pkg) ).to be === true
34
39
  end
@@ -36,7 +41,7 @@ module Beaker
36
41
  it "checks correctly on fedora" do
37
42
  @opts = {'platform' => 'fedora-is-me'}
38
43
  pkg = 'fedora_package'
39
- expect( Beaker::Command ).to receive(:new).with("rpm -q #{pkg}").and_return('')
44
+ expect( Beaker::Command ).to receive(:new).with("rpm -q #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
40
45
  expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
41
46
  expect( instance.check_for_package(pkg) ).to be === true
42
47
  end
@@ -44,7 +49,7 @@ module Beaker
44
49
  it "checks correctly on centos" do
45
50
  @opts = {'platform' => 'centos-is-me'}
46
51
  pkg = 'centos_package'
47
- expect( Beaker::Command ).to receive(:new).with("rpm -q #{pkg}").and_return('')
52
+ expect( Beaker::Command ).to receive(:new).with("rpm -q #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
48
53
  expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
49
54
  expect( instance.check_for_package(pkg) ).to be === true
50
55
  end
@@ -52,7 +57,7 @@ module Beaker
52
57
  it "checks correctly on EOS" do
53
58
  @opts = {'platform' => 'eos-is-me'}
54
59
  pkg = 'eos-package'
55
- expect( Beaker::Command ).to receive(:new).with("rpm -q #{pkg}").and_return('')
60
+ expect( Beaker::Command ).to receive(:new).with("rpm -q #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
56
61
  expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
57
62
  expect( instance.check_for_package(pkg) ).to be === true
58
63
  end
@@ -60,7 +65,7 @@ module Beaker
60
65
  it "checks correctly on el-" do
61
66
  @opts = {'platform' => 'el-is-me'}
62
67
  pkg = 'el_package'
63
- expect( Beaker::Command ).to receive(:new).with("rpm -q #{pkg}").and_return('')
68
+ expect( Beaker::Command ).to receive(:new).with("rpm -q #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
64
69
  expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
65
70
  expect( instance.check_for_package(pkg) ).to be === true
66
71
  end
@@ -68,7 +73,7 @@ module Beaker
68
73
  it "checks correctly on debian" do
69
74
  @opts = {'platform' => 'debian-is-me'}
70
75
  pkg = 'debian_package'
71
- expect( Beaker::Command ).to receive(:new).with("dpkg -s #{pkg}").and_return('')
76
+ expect( Beaker::Command ).to receive(:new).with("dpkg -s #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
72
77
  expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
73
78
  expect( instance.check_for_package(pkg) ).to be === true
74
79
  end
@@ -76,7 +81,7 @@ module Beaker
76
81
  it "checks correctly on ubuntu" do
77
82
  @opts = {'platform' => 'ubuntu-is-me'}
78
83
  pkg = 'ubuntu_package'
79
- expect( Beaker::Command ).to receive(:new).with("dpkg -s #{pkg}").and_return('')
84
+ expect( Beaker::Command ).to receive(:new).with("dpkg -s #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
80
85
  expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
81
86
  expect( instance.check_for_package(pkg) ).to be === true
82
87
  end
@@ -84,7 +89,7 @@ module Beaker
84
89
  it "checks correctly on cumulus" do
85
90
  @opts = {'platform' => 'cumulus-is-me'}
86
91
  pkg = 'cumulus_package'
87
- expect( Beaker::Command ).to receive(:new).with("dpkg -s #{pkg}").and_return('')
92
+ expect( Beaker::Command ).to receive(:new).with("dpkg -s #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
88
93
  expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
89
94
  expect( instance.check_for_package(pkg) ).to be === true
90
95
  end
@@ -92,7 +97,7 @@ module Beaker
92
97
  it "checks correctly on solaris-11" do
93
98
  @opts = {'platform' => 'solaris-11-is-me'}
94
99
  pkg = 'solaris-11_package'
95
- expect( Beaker::Command ).to receive(:new).with("pkg info #{pkg}").and_return('')
100
+ expect( Beaker::Command ).to receive(:new).with("pkg info #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
96
101
  expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
97
102
  expect( instance.check_for_package(pkg) ).to be === true
98
103
  end
@@ -100,7 +105,7 @@ module Beaker
100
105
  it "checks correctly on solaris-10" do
101
106
  @opts = {'platform' => 'solaris-10-is-me'}
102
107
  pkg = 'solaris-10_package'
103
- expect( Beaker::Command ).to receive(:new).with("pkginfo #{pkg}").and_return('')
108
+ expect( Beaker::Command ).to receive(:new).with("pkginfo #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
104
109
  expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0}))
105
110
  expect( instance.check_for_package(pkg) ).to be === true
106
111
  end