summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpencer Krum <nibz@spencerkrum.com>2015-07-28 02:04:53 -0700
committerSpencer Krum <nibz@spencerkrum.com>2015-07-28 02:04:53 -0700
commitce473c9cb858950e08da3f0964fbd6f815abc523 (patch)
tree8ecc6702b8d52bf11131a14c885ff92669097a47
parent1dd25cd29d4f871c97ed071591f647443d338e24 (diff)
Boilerplate beaker-rspec files
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:26:18 +0000 Reviewed-on: https://review.openstack.org/206392 Project: openstack-infra/puppet-logrotate Branch: refs/heads/master
-rw-r--r--spec/acceptance/nodesets/default.yml11
-rw-r--r--spec/acceptance/nodesets/nodepool-centos7.yml10
-rw-r--r--spec/acceptance/nodesets/nodepool-trusty.yml10
-rw-r--r--spec/spec_helper_acceptance.rb58
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 @@
1HOSTS:
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
9CONFIG:
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 @@
1HOSTS:
2 centos-70-x64:
3 roles:
4 - master
5 platform: el-7-x86_64
6 hypervisor: none
7 ip: 127.0.0.1
8CONFIG:
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 @@
1HOSTS:
2 ubuntu-14.04-amd64:
3 roles:
4 - master
5 platform: ubuntu-14.04-amd64
6 hypervisor: none
7 ip: 127.0.0.1
8CONFIG:
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 @@
1require 'beaker-rspec'
2
3hosts.each do |host|
4
5 install_puppet
6
7 on host, "mkdir -p #{host['distmoduledir']}"
8end
9
10RSpec.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
58end