]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/keystone/spec/spec_helper_acceptance.rb
Update to Kilo
[dsa-puppet.git] / 3rdparty / modules / keystone / spec / spec_helper_acceptance.rb
1 require 'beaker-rspec'
2 require 'beaker/puppet_install_helper'
3
4 run_puppet_install_helper
5
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
11   # Readable test descriptions
12   c.formatter = :documentation
13
14   # Configure all nodes in nodeset
15   c.before :suite do
16     # Install module and dependencies
17     hosts.each do |host|
18
19       # install git
20       install_package host, 'git'
21
22       zuul_ref = ENV['ZUUL_REF']
23       zuul_branch = ENV['ZUUL_BRANCH']
24       zuul_url = ENV['ZUUL_URL']
25
26       repo = 'openstack/puppet-openstack-integration'
27
28       # Start out with clean moduledir, don't trust r10k to purge it
29       on host, "rm -rf /etc/puppet/modules/*"
30       # Install dependent modules via git or zuul
31       r = on host, "test -e /usr/zuul-env/bin/zuul-cloner", { :acceptable_exit_codes => [0,1] }
32       if r.exit_code == 0
33         zuul_clone_cmd = '/usr/zuul-env/bin/zuul-cloner '
34         zuul_clone_cmd += '--cache-dir /opt/git '
35         zuul_clone_cmd += "--zuul-ref #{zuul_ref} "
36         zuul_clone_cmd += "--zuul-branch #{zuul_branch} "
37         zuul_clone_cmd += "--zuul-url #{zuul_url} "
38         zuul_clone_cmd += "git://git.openstack.org #{repo}"
39         on host, zuul_clone_cmd
40       else
41         on host, "git clone https://git.openstack.org/#{repo} #{repo}"
42       end
43
44       on host, "ZUUL_REF=#{zuul_ref} ZUUL_BRANCH=#{zuul_branch} ZUUL_URL=#{zuul_url} bash #{repo}/install_modules.sh"
45
46       # Install the module being tested
47       on host, "rm -fr /etc/puppet/modules/#{modname}"
48       puppet_module_install(:source => proj_root, :module_name => modname)
49
50       on host, "rm -fr #{repo}"
51
52       # List modules installed to help with debugging
53       on host, puppet('module','list'), { :acceptable_exit_codes => 0 }
54     end
55   end
56 end