diff options
author | Spencer Krum <nibz@spencerkrum.com> | 2015-07-28 02:05:44 -0700 |
---|---|---|
committer | Spencer Krum <nibz@spencerkrum.com> | 2015-07-28 02:05:44 -0700 |
commit | fd5702d3787c49e18b5996af68b662a5a7412c11 (patch) | |
tree | 187e1ac64d2f1b8c85f67cefdef293ccbb9516f1 | |
parent | 367240c5c218fedad83584f899864a9765a1edc4 (diff) |
Boilerplate beaker-rspec files
Change-Id: I061de37e033c5eb4dd3a4e86a55aba09f3c731f3
Notes
Notes (review):
Code-Review+2: James E. Blair <corvus@inaugust.com>
Workflow+1: James E. Blair <corvus@inaugust.com>
Verified+2: Jenkins
Code-Review+1: Clint Adams <clint@gcfm.net>
Submitted-by: Jenkins
Submitted-at: Thu, 30 Jul 2015 00:31:54 +0000
Reviewed-on: https://review.openstack.org/206411
Project: openstack-infra/puppet-reviewday
Branch: refs/heads/master
-rw-r--r-- | spec/acceptance/nodesets/default.yml | 11 | ||||
-rw-r--r-- | spec/acceptance/nodesets/nodepool-centos7.yml | 10 | ||||
-rw-r--r-- | spec/acceptance/nodesets/nodepool-trusty.yml | 10 | ||||
-rw-r--r-- | spec/spec_helper_acceptance.rb | 58 |
4 files changed, 89 insertions, 0 deletions
diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml new file mode 100644 index 0000000..3bb3e62 --- /dev/null +++ b/spec/acceptance/nodesets/default.yml | |||
@@ -0,0 +1,11 @@ | |||
1 | HOSTS: | ||
2 | ubuntu-server-1404-x64: | ||
3 | roles: | ||
4 | - master | ||
5 | platform: ubuntu-14.04-amd64 | ||
6 | box: puppetlabs/ubuntu-14.04-64-nocm | ||
7 | box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm | ||
8 | hypervisor: vagrant | ||
9 | CONFIG: | ||
10 | log_level: debug | ||
11 | type: git | ||
diff --git a/spec/acceptance/nodesets/nodepool-centos7.yml b/spec/acceptance/nodesets/nodepool-centos7.yml new file mode 100644 index 0000000..c552874 --- /dev/null +++ b/spec/acceptance/nodesets/nodepool-centos7.yml | |||
@@ -0,0 +1,10 @@ | |||
1 | HOSTS: | ||
2 | centos-70-x64: | ||
3 | roles: | ||
4 | - master | ||
5 | platform: el-7-x86_64 | ||
6 | hypervisor: none | ||
7 | ip: 127.0.0.1 | ||
8 | CONFIG: | ||
9 | type: foss | ||
10 | set_env: false | ||
diff --git a/spec/acceptance/nodesets/nodepool-trusty.yml b/spec/acceptance/nodesets/nodepool-trusty.yml new file mode 100644 index 0000000..9fc624e --- /dev/null +++ b/spec/acceptance/nodesets/nodepool-trusty.yml | |||
@@ -0,0 +1,10 @@ | |||
1 | HOSTS: | ||
2 | ubuntu-14.04-amd64: | ||
3 | roles: | ||
4 | - master | ||
5 | platform: ubuntu-14.04-amd64 | ||
6 | hypervisor: none | ||
7 | ip: 127.0.0.1 | ||
8 | CONFIG: | ||
9 | type: foss | ||
10 | set_env: false | ||
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb new file mode 100644 index 0000000..a3a42aa --- /dev/null +++ b/spec/spec_helper_acceptance.rb | |||
@@ -0,0 +1,58 @@ | |||
1 | require 'beaker-rspec' | ||
2 | |||
3 | hosts.each do |host| | ||
4 | |||
5 | install_puppet | ||
6 | |||
7 | on host, "mkdir -p #{host['distmoduledir']}" | ||
8 | end | ||
9 | |||
10 | RSpec.configure do |c| | ||
11 | # Project root | ||
12 | proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) | ||
13 | modname = JSON.parse(open('metadata.json').read)['name'].split('-')[1] | ||
14 | |||
15 | # Readable test descriptions | ||
16 | c.formatter = :documentation | ||
17 | |||
18 | # Configure all nodes in nodeset | ||
19 | c.before :suite do | ||
20 | # Install module and dependencies | ||
21 | hosts.each do |host| | ||
22 | |||
23 | # Clean out any module cruft | ||
24 | shell('rm -fr /etc/puppet/modules/*') | ||
25 | |||
26 | # install git | ||
27 | install_package host, 'git' | ||
28 | |||
29 | zuul_ref = ENV['ZUUL_REF'] | ||
30 | zuul_branch = ENV['ZUUL_BRANCH'] | ||
31 | zuul_url = ENV['ZUUL_URL'] | ||
32 | |||
33 | # Install dependent modules via git or zuul | ||
34 | r = on host, "test -e /usr/zuul-env/bin/zuul-cloner", { :acceptable_exit_codes => [0,1] } | ||
35 | repo = 'openstack-infra/system-config' | ||
36 | if r.exit_code == 0 | ||
37 | zuul_clone_cmd = '/usr/zuul-env/bin/zuul-cloner ' | ||
38 | zuul_clone_cmd += '--cache-dir /opt/git ' | ||
39 | zuul_clone_cmd += "--zuul-ref #{zuul_ref} " | ||
40 | zuul_clone_cmd += "--zuul-branch #{zuul_branch} " | ||
41 | zuul_clone_cmd += "--zuul-url #{zuul_url} " | ||
42 | zuul_clone_cmd += "git://git.openstack.org #{repo}" | ||
43 | on host, zuul_clone_cmd | ||
44 | else | ||
45 | on host, "git clone https://git.openstack.org/#{repo}" | ||
46 | end | ||
47 | |||
48 | on host, "ZUUL_REF=#{zuul_ref} ZUUL_BRANCH=#{zuul_branch} ZUUL_URL=#{zuul_url} bash #{repo}/tools/install_modules_acceptance.sh" | ||
49 | on host, "rm -fr /etc/puppet/modules/#{modname}" | ||
50 | |||
51 | # Install the module being tested | ||
52 | puppet_module_install(:source => proj_root, :module_name => modname) | ||
53 | on host, "rm -fr #{repo}" | ||
54 | # List modules installed to help with debugging | ||
55 | on hosts[0], puppet('module','list'), { :acceptable_exit_codes => 0 } | ||
56 | end | ||
57 | end | ||
58 | end | ||