Puppet module for Project_config
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

spec_helper_acceptance.rb 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. require 'beaker-rspec'
  2. hosts.each do |host|
  3. install_puppet
  4. on host, "mkdir -p #{host['distmoduledir']}"
  5. end
  6. RSpec.configure do |c|
  7. # Project root
  8. proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
  9. modname = JSON.parse(open('metadata.json').read)['name'].split('-')[1]
  10. # Readable test descriptions
  11. c.formatter = :documentation
  12. # Configure all nodes in nodeset
  13. c.before :suite do
  14. # Install module and dependencies
  15. hosts.each do |host|
  16. # Clean out any module cruft
  17. shell('rm -fr /etc/puppet/modules/*')
  18. # install git
  19. install_package host, 'git'
  20. zuul_ref = ENV['ZUUL_REF']
  21. zuul_branch = ENV['ZUUL_BRANCH']
  22. zuul_url = ENV['ZUUL_URL']
  23. # Install dependent modules via git or zuul
  24. r = on host, "test -e /usr/zuul-env/bin/zuul-cloner", { :acceptable_exit_codes => [0,1] }
  25. repo = 'openstack-infra/system-config'
  26. if r.exit_code == 0
  27. zuul_clone_cmd = '/usr/zuul-env/bin/zuul-cloner '
  28. zuul_clone_cmd += '--cache-dir /opt/git '
  29. zuul_clone_cmd += "--zuul-ref #{zuul_ref} "
  30. zuul_clone_cmd += "--zuul-branch #{zuul_branch} "
  31. zuul_clone_cmd += "--zuul-url #{zuul_url} "
  32. zuul_clone_cmd += "git://git.openstack.org #{repo}"
  33. on host, zuul_clone_cmd
  34. else
  35. on host, "git clone https://git.openstack.org/#{repo} #{repo}"
  36. end
  37. on host, "ZUUL_REF=#{zuul_ref} ZUUL_BRANCH=#{zuul_branch} ZUUL_URL=#{zuul_url} bash #{repo}/tools/install_modules_acceptance.sh"
  38. on host, "rm -fr /etc/puppet/modules/#{modname}"
  39. # Install the module being tested
  40. puppet_module_install(:source => proj_root, :module_name => modname)
  41. on host, "rm -fr #{repo}"
  42. # List modules installed to help with debugging
  43. on hosts[0], puppet('module','list'), { :acceptable_exit_codes => 0 }
  44. end
  45. end
  46. end