Beaker tests
Implement basic structure for beaker tests. Change-Id: Ia2d7ab0f77c0cfc5edb3c08316b93f179a859757 Closes-bug: #1444736
This commit is contained in:
parent
62c8e5632f
commit
b3d764809c
1
Gemfile
1
Gemfile
@ -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
|
||||
|
@ -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
|
||||
-------------
|
||||
|
||||
|
25
spec/acceptance/basic_tempest_spec.rb
Normal file
25
spec/acceptance/basic_tempest_spec.rb
Normal 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
|
9
spec/acceptance/nodesets/default.yml
Normal file
9
spec/acceptance/nodesets/default.yml
Normal 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
|
9
spec/acceptance/nodesets/nodepool.yml
Normal file
9
spec/acceptance/nodesets/nodepool.yml
Normal 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
|
39
spec/spec_helper_acceptance.rb
Normal file
39
spec/spec_helper_acceptance.rb
Normal 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
|
Loading…
x
Reference in New Issue
Block a user