spec_helper_acceptance.rb 2.1 KB

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