spec_helper_acceptance.rb 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. require 'beaker-rspec/spec_helper'
  2. require 'beaker-rspec/helpers/serverspec'
  3. hosts.each do |host|
  4. if host['platform'] =~ /debian/
  5. on host, 'echo \'export PATH=/var/lib/gems/1.8/bin/:${PATH}\' >> ~/.bashrc'
  6. end
  7. #install_puppet
  8. if host['platform'] =~ /el-(5|6)/
  9. relver = $1
  10. on host, "rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-#{relver}.noarch.rpm"
  11. on host, 'yum install -y puppet puppet-server'
  12. elsif host['platform'] =~ /fedora-(\d+)/
  13. relver = $1
  14. on host, "rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-fedora-#{relver}.noarch.rpm"
  15. on host, 'yum install -y puppet-server'
  16. elsif host['platform'] =~ /(ubuntu|debian)/
  17. if ! host.check_for_package 'curl'
  18. on host, 'apt-get install -y curl'
  19. end
  20. on host, 'curl -O http://apt.puppetlabs.com/puppetlabs-release-$(lsb_release -c -s).deb'
  21. on host, 'dpkg -i puppetlabs-release-$(lsb_release -c -s).deb'
  22. on host, 'apt-get -y -f -m update'
  23. on host, 'apt-get install -y puppet puppetmaster'
  24. else
  25. raise "install_puppet() called for unsupported platform '#{host['platform']}' on '#{host.name}'"
  26. end
  27. end
  28. RSpec.configure do |c|
  29. # Project root
  30. proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
  31. # Readable test descriptions
  32. c.formatter = :documentation
  33. # Configure all nodes in nodeset
  34. c.before :suite do
  35. hosts.each do |host|
  36. # Install module and dependencies
  37. copy_module_to(host, :source => proj_root, :module_name => 'puppetdb')
  38. on host, puppet('module', 'install', 'puppetlabs-ntp'), { :acceptable_exit_codes => [0,1] }
  39. on host, puppet('module', 'install', 'puppetlabs-postgresql', '--version', '">= 3.1.0 <4.0.0"'), { :acceptable_exit_codes => [0,1] }
  40. on host, puppet('module', 'install', 'puppetlabs-inifile', '--version', '1.x'), { :acceptable_exit_codes => [0,1] }
  41. end
  42. end
  43. end