summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Gemfile12
-rw-r--r--spec/acceptance/openstack_pip_provider_spec.rb2
-rw-r--r--spec/spec_helper_acceptance.rb66
3 files changed, 9 insertions, 71 deletions
diff --git a/Gemfile b/Gemfile
index fbec945..9854cc9 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,11 +1,15 @@
1source 'https://rubygems.org' 1source 'https://rubygems.org'
2 2
3if ENV['ZUUL_REF'] && File.exists?("#{ENV['WORKSPACE']}/openstack-infra/puppet-openstack_infra_spec_helper")
4 gem_checkout_method = {:path => "#{ENV['WORKSPACE']}/openstack-infra/puppet-openstack_infra_spec_helper"}
5else
6 gem_checkout_method = {:git => 'https://git.openstack.org/openstack-infra/puppet-openstack_infra_spec_helper'}
7end
8gem_checkout_method[:require] = false
9
3group :development, :test, :system_tests do 10group :development, :test, :system_tests do
4 gem 'puppet-openstack_infra_spec_helper', 11 gem 'puppet-openstack_infra_spec_helper',
5 :git => 'https://git.openstack.org/openstack-infra/puppet-openstack_infra_spec_helper', 12 gem_checkout_method
6 :require => false
7 # Not all modules can do this, so we add it here to the ones that can
8 gem 'puppet-lint-empty_string-check'
9end 13end
10 14
11# vim:ft=ruby 15# vim:ft=ruby
diff --git a/spec/acceptance/openstack_pip_provider_spec.rb b/spec/acceptance/openstack_pip_provider_spec.rb
index 9b2c36e..36ccd72 100644
--- a/spec/acceptance/openstack_pip_provider_spec.rb
+++ b/spec/acceptance/openstack_pip_provider_spec.rb
@@ -1,4 +1,4 @@
1require 'spec_helper_acceptance' 1require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance'
2 2
3describe 'custom pip provider' do 3describe 'custom pip provider' do
4 4
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb
deleted file mode 100644
index de96291..0000000
--- a/spec/spec_helper_acceptance.rb
+++ /dev/null
@@ -1,66 +0,0 @@
1require 'beaker-rspec'
2
3hosts.each do |host|
4
5 # puppet 3 isn't available from apt.puppetlabs.com so install it from the Xenial repos
6 on host, "which apt-get && apt-get install puppet -y", { :acceptable_exit_codes => [0,1] }
7 # otherwise use the beaker helpers to install the yum.puppetlabs.com repo and puppet
8 r = on host, "which yum", { :acceptable_exit_codes => [0,1] }
9 if r.exit_code == 0
10 install_puppet
11 end
12 add_platform_foss_defaults(host, 'unix')
13
14
15 on host, "mkdir -p #{host['distmoduledir']}"
16end
17
18RSpec.configure do |c|
19 # Project root
20 proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
21 modname = JSON.parse(open('metadata.json').read)['name'].split('-')[1]
22
23 # Readable test descriptions
24 c.formatter = :documentation
25
26 # Configure all nodes in nodeset
27 c.before :suite do
28 # Install module and dependencies
29 hosts.each do |host|
30
31 # Clean out any module cruft
32 shell('rm -fr /etc/puppet/modules/*')
33
34 # install git
35 install_package host, 'git'
36
37 zuul_ref = ENV['ZUUL_REF']
38 zuul_branch = ENV['ZUUL_BRANCH']
39 zuul_url = ENV['ZUUL_URL']
40
41 # Install dependent modules via git or zuul
42 r = on host, "test -e /usr/zuul-env/bin/zuul-cloner", { :acceptable_exit_codes => [0,1] }
43 repo = 'openstack-infra/system-config'
44 if r.exit_code == 0
45 zuul_clone_cmd = '/usr/zuul-env/bin/zuul-cloner '
46 zuul_clone_cmd += '--cache-dir /opt/git '
47 zuul_clone_cmd += "--zuul-ref #{zuul_ref} "
48 zuul_clone_cmd += "--zuul-branch #{zuul_branch} "
49 zuul_clone_cmd += "--zuul-url #{zuul_url} "
50 zuul_clone_cmd += "git://git.openstack.org #{repo}"
51 on host, zuul_clone_cmd
52 else
53 on host, "git clone https://git.openstack.org/#{repo} #{repo}"
54 end
55
56 on host, "ZUUL_REF=#{zuul_ref} ZUUL_BRANCH=#{zuul_branch} ZUUL_URL=#{zuul_url} bash #{repo}/tools/install_modules_acceptance.sh"
57 on host, "rm -fr /etc/puppet/modules/#{modname}"
58
59 # Install the module being tested
60 puppet_module_install(:source => proj_root, :module_name => modname)
61 on host, "rm -fr #{repo}"
62 # List modules installed to help with debugging
63 on hosts[0], puppet('module','list'), { :acceptable_exit_codes => 0 }
64 end
65 end
66end