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:
parent
92d9be12cd
commit
14c16142e0
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
||||
spec/fixtures/modules/*
|
||||
pkg
|
||||
Gemfile.lock
|
||||
.vagrant/*
|
||||
|
4
Gemfile
4
Gemfile
@ -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'
|
||||
|
13
README.md
13
README.md
@ -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
|
||||
------------
|
||||
|
||||
|
39
spec/acceptance/class_spec.rb
Normal file
39
spec/acceptance/class_spec.rb
Normal 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
|
10
spec/acceptance/nodesets/centos-64-x64.yml
Normal file
10
spec/acceptance/nodesets/centos-64-x64.yml
Normal 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
|
9
spec/acceptance/nodesets/default.yml
Normal file
9
spec/acceptance/nodesets/default.yml
Normal 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
|
9
spec/acceptance/nodesets/nodepool.yml
Normal file
9
spec/acceptance/nodesets/nodepool.yml
Normal 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
|
34
spec/spec_helper_acceptance.rb
Normal file
34
spec/spec_helper_acceptance.rb
Normal 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
|
Loading…
x
Reference in New Issue
Block a user