Initial rspec-beaker testing scaffolding

This allows basic beaker testing to be performed inside
the openstack testing framework.

Change-Id: Iecd247d35c9041ff865544b07811d728c27cf919
This commit is contained in:
Spencer Krum 2014-06-23 14:35:07 -07:00
parent 92d9be12cd
commit 14c16142e0
8 changed files with 118 additions and 1 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
spec/fixtures/modules/*
pkg
Gemfile.lock
.vagrant/*

View File

@ -1,9 +1,11 @@
source 'https://rubygems.org'
group :development, :test do
gem 'puppetlabs_spec_helper', :require => false
gem 'puppetlabs_spec_helper', :require => false
gem 'puppet-lint', '~> 0.3.2'
gem 'rake', '10.1.1'
gem 'rspec-puppet', :require => false
gem 'beaker-rspec', '~> 2.2.4', :require => false
gem 'rspec', '< 2.99'
gem 'json'
gem 'webmock'

View File

@ -82,6 +82,19 @@ Developer documentation for the entire puppet-openstack project.
* https://wiki.openstack.org/wiki/Puppet-openstack#Developer_documentation
Beaker-Rspec
------------
This module has beaker-rspec tests
To run:
```shell
bundle install
BEAKER_setfile=default bundle exec rspec spec/acceptance
```
Contributors
------------

View File

@ -0,0 +1,39 @@
require 'spec_helper_acceptance'
describe 'nova class' do
context 'default parameters' do
it 'should work with no errors' do
pp= <<-EOS
include epel # Get our epel on
class { 'nova':
database_connection => 'mysql://nova:a_big_secret@127.0.0.1/nova?charset=utf8',
rabbit_userid => 'nova',
rabbit_password => 'an_even_bigger_secret',
image_service => 'nova.image.glance.GlanceImageService',
glance_api_servers => 'localhost:9292',
verbose => false,
rabbit_host => '127.0.0.1',
mysql_module => '2.2',
}
class { 'nova::compute':
enabled => true,
vnc_enabled => true,
}
class { 'nova::compute::libvirt':
migration_support => true,
vncserver_listen => '0.0.0.0',
}
EOS
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
end
end

View File

@ -0,0 +1,10 @@
HOSTS:
centos-64-x64:
roles:
- master
platform: el-6-x86_64
box : centos-64-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: foss

View File

@ -0,0 +1,9 @@
HOSTS:
ubuntu-server-14041-x64:
roles:
- master
platform: ubuntu-14.04-amd64
hypervisor : none
ip: 127.0.0.1
CONFIG:
type: foss

View File

@ -0,0 +1,9 @@
HOSTS:
ubuntu-server-12042-x64:
roles:
- master
platform: ubuntu-12.04-amd64
hypervisor : none
ip: 127.0.0.1
CONFIG:
type: foss

View File

@ -0,0 +1,34 @@
require 'beaker-rspec'
hosts.each do |host|
install_puppet
on host, "mkdir -p #{host['distmoduledir']}"
end
RSpec.configure do |c|
# Project root
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
# Readable test descriptions
c.formatter = :documentation
# Configure all nodes in nodeset
c.before :suite do
# Install module
puppet_module_install(:source => proj_root, :module_name => 'nova')
hosts.each do |host|
on host, puppet('module','install','dprince/qpid'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','duritong/sysctl'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','puppetlabs-cinder'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','puppetlabs-glance'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','puppetlabs-inifile'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','stahnma-epel'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','puppetlabs-keystone'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','puppetlabs-mysql', '--version', '2.2'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','puppetlabs-rabbitmq'), { :acceptable_exit_codes => [0,1] }
on host, puppet('module','install','puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] }
end
end
end