Beaker tests

Implement basic structure for beaker tests.

Change-Id: Ia2d7ab0f77c0cfc5edb3c08316b93f179a859757
Closes-bug: #1444736
This commit is contained in:
Emilien Macchi 2015-04-29 14:42:32 -04:00
parent 62c8e5632f
commit b3d764809c
6 changed files with 95 additions and 0 deletions

View File

@ -15,6 +15,7 @@ group :development, :test do
gem 'puppet-lint-variable_contains_upcase'
gem 'puppet-lint-numericvariable'
gem 'beaker-rspec', '~> 2.2.4', :require => false
gem 'json'
gem 'webmock'
end

View File

@ -11,6 +11,18 @@ tests on an installed openstack environment.
This module assumes the provisioning of the initial OpenStack
resources has been done beforehand.
Beaker-Rspec
------------
This module has beaker-rspec tests
To run:
``shell
bundle install
bundle exec rspec spec/acceptance
``
Release Notes
-------------

View File

@ -0,0 +1,25 @@
require 'spec_helper_acceptance'
describe 'basic tempest' do
context 'default parameters' do
it 'should work with no errors' do
pp= <<-EOS
Exec { logoutput => 'on_failure' }
class { '::tempest':
setup_venv => true,
configure_images => false,
configure_networks => false,
}
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,9 @@
HOSTS:
ubuntu-14.04-amd64:
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-14.04-amd64:
roles:
- master
platform: ubuntu-14.04-amd64
hypervisor : none
ip: 127.0.0.1
CONFIG:
type: foss

View File

@ -0,0 +1,39 @@
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 and dependencies
hosts.each do |host|
# install git
install_package host, 'git'
# clean out any module cruft
shell('rm -fr /etc/puppet/modules/*')
# install library modules from the forge
on host, puppet('module','install','puppetlabs-inifile'), { :acceptable_exit_codes => 0 }
on host, puppet('module','install','puppetlabs-stdlib'), { :acceptable_exit_codes => 0 }
on host, puppet('module','install','puppetlabs-vcsrepo'), { :acceptable_exit_codes => 0 }
# Install the module being tested
puppet_module_install(:source => proj_root, :module_name => 'tempest')
# List modules installed to help with debugging
on hosts[0], puppet('module','list'), { :acceptable_exit_codes => 0 }
end
end
end