spec_helper_acceptance.rb 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. require 'beaker-rspec/spec_helper'
  2. require 'beaker-rspec/helpers/serverspec'
  3. unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no'
  4. # This will install the latest available package on el and deb based
  5. # systems fail on windows and osx, and install via gem on other *nixes
  6. foss_opts = {:default_action => 'gem_install'}
  7. if default.is_pe?; then
  8. install_pe;
  9. else
  10. install_puppet(foss_opts);
  11. end
  12. hosts.each do |host|
  13. on hosts, "mkdir -p #{host['distmoduledir']}"
  14. if host['platform'] =~ /sles-1/i || host['platform'] =~ /solaris-1/i
  15. get_stdlib = <<-EOS
  16. package{'wget':}
  17. exec{'download':
  18. command => "wget -P /root/ https://forgeapi.puppetlabs.com/v3/files/puppetlabs-stdlib-4.3.2.tar.gz --no-check-certificate",
  19. path => ['/opt/csw/bin/','/usr/bin/']
  20. }
  21. EOS
  22. apply_manifest_on(host, get_stdlib)
  23. # have to use force otherwise it checks ssl cert even though it is a local file
  24. on host, puppet('module install /root/puppetlabs-stdlib-4.3.2.tar.gz --force --ignore-dependencies'), {:acceptable_exit_codes => [0, 1]}
  25. elsif host['platform'] =~ /windows/i
  26. on host, shell('curl -k -o c:/puppetlabs-stdlib-4.3.2.tar.gz https://forgeapi.puppetlabs.com/v3/files/puppetlabs-stdlib-4.3.2.tar.gz')
  27. on host, puppet('module install c:/puppetlabs-stdlib-4.3.2.tar.gz --force --ignore-dependencies'), {:acceptable_exit_codes => [0, 1]}
  28. else
  29. on host, puppet('module install puppetlabs-stdlib'), {:acceptable_exit_codes => [0, 1]}
  30. end
  31. end
  32. end
  33. RSpec.configure do |c|
  34. # Project root
  35. proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
  36. # Readable test descriptions
  37. c.formatter = :documentation
  38. # Configure all nodes in nodeset
  39. c.before :suite do
  40. hosts.each do |host|
  41. copy_module_to(host, :source => proj_root, :module_name => 'concat')
  42. end
  43. end
  44. c.before(:all) do
  45. shell('mkdir -p /tmp/concat')
  46. end
  47. c.after(:all) do
  48. shell('rm -rf /tmp/concat /var/lib/puppet/concat')
  49. end
  50. c.treat_symbols_as_metadata_keys_with_true_values = true
  51. end