Beaker tests
Implement basic structure for beaker tests. Change-Id: Ibfe041a7f500502ce357981a7ef917d1ce2a1760 Closes-bug: #1444736
This commit is contained in:
parent
eaddd54d8a
commit
79d307044a
1
Gemfile
1
Gemfile
@ -16,6 +16,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
|
||||
|
12
README.md
12
README.md
@ -118,6 +118,18 @@ Limitations
|
||||
|
||||
* Only supports configuring the file, swift and rbd storage backends.
|
||||
|
||||
Beaker-Rspec
|
||||
------------
|
||||
|
||||
This module has beaker-rspec tests
|
||||
|
||||
To run:
|
||||
|
||||
```shell
|
||||
bundle install
|
||||
bundle exec rspec spec/acceptance
|
||||
```
|
||||
|
||||
Development
|
||||
-----------
|
||||
|
||||
|
86
spec/acceptance/class_spec.rb
Normal file
86
spec/acceptance/class_spec.rb
Normal file
@ -0,0 +1,86 @@
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'glance class' do
|
||||
|
||||
context 'default parameters' do
|
||||
|
||||
it 'should work with no errors' do
|
||||
pp= <<-EOS
|
||||
Exec { logoutput => 'on_failure' }
|
||||
|
||||
# Common resources
|
||||
case $::osfamily {
|
||||
'Debian': {
|
||||
include ::apt
|
||||
# some packages are not autoupgraded in trusty.
|
||||
# it will be fixed in liberty, but broken in kilo.
|
||||
$need_to_be_upgraded = ['python-tz', 'python-pbr']
|
||||
apt::source { 'trusty-updates-kilo':
|
||||
location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu/',
|
||||
release => 'trusty-updates',
|
||||
required_packages => 'ubuntu-cloud-keyring',
|
||||
repos => 'kilo/main',
|
||||
trusted_source => true,
|
||||
} ->
|
||||
package { $need_to_be_upgraded:
|
||||
ensure => latest,
|
||||
}
|
||||
}
|
||||
'RedHat': {
|
||||
include ::epel # Get our epel on
|
||||
}
|
||||
}
|
||||
class { '::mysql::server': }
|
||||
|
||||
# Keystone resources, needed by Glance to run
|
||||
class { '::keystone::db::mysql':
|
||||
# https://bugs.launchpad.net/puppet-keystone/+bug/1446375
|
||||
collate => 'utf8_general_ci',
|
||||
password => 'keystone',
|
||||
}
|
||||
class { '::keystone':
|
||||
verbose => true,
|
||||
debug => true,
|
||||
database_connection => 'mysql://keystone:keystone@127.0.0.1/keystone',
|
||||
admin_token => 'admin_token',
|
||||
enabled => true,
|
||||
}
|
||||
class { '::keystone::roles::admin':
|
||||
email => 'test@example.tld',
|
||||
password => 'a_big_secret',
|
||||
}
|
||||
class { '::keystone::endpoint':
|
||||
public_url => "https://${::fqdn}:5000/",
|
||||
admin_url => "https://${::fqdn}:35357/",
|
||||
}
|
||||
|
||||
# Glance resources
|
||||
include ::glance
|
||||
include ::glance::client
|
||||
class { '::glance::db::mysql':
|
||||
# https://bugs.launchpad.net/puppet-glance/+bug/1446375
|
||||
collate => 'utf8_general_ci',
|
||||
password => 'a_big_secret',
|
||||
}
|
||||
class { '::glance::keystone::auth':
|
||||
password => 'a_big_secret',
|
||||
}
|
||||
class { '::glance::api':
|
||||
database_connection => 'mysql://glance:a_big_secret@127.0.0.1/glance?charset=utf8',
|
||||
verbose => false,
|
||||
keystone_password => 'big_secret',
|
||||
}
|
||||
class { '::glance::registry':
|
||||
database_connection => 'mysql://glance:a_big_secret@127.0.0.1/glance?charset=utf8',
|
||||
verbose => false,
|
||||
keystone_password => 'a_big_secret',
|
||||
}
|
||||
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/centos-70-x64.yml
Normal file
9
spec/acceptance/nodesets/centos-70-x64.yml
Normal file
@ -0,0 +1,9 @@
|
||||
HOSTS:
|
||||
centos-70-x64:
|
||||
roles:
|
||||
- master
|
||||
platform: el-7-x86_64
|
||||
box : puppetlabs/centos-7.0-64-nocm
|
||||
hypervisor : vagrant
|
||||
CONFIG:
|
||||
type: foss
|
11
spec/acceptance/nodesets/default.yml
Normal file
11
spec/acceptance/nodesets/default.yml
Normal file
@ -0,0 +1,11 @@
|
||||
HOSTS:
|
||||
ubuntu-server-1404-x64:
|
||||
roles:
|
||||
- master
|
||||
platform: ubuntu-14.04-amd64
|
||||
box : trusty-server-cloudimg-amd64-vagrant-disk1
|
||||
box_url : puppetlabs/ubuntu-14.04-64-nocm
|
||||
hypervisor : vagrant
|
||||
CONFIG:
|
||||
log_level : debug
|
||||
type: git
|
9
spec/acceptance/nodesets/nodepool-centos7.yml
Normal file
9
spec/acceptance/nodesets/nodepool-centos7.yml
Normal file
@ -0,0 +1,9 @@
|
||||
HOSTS:
|
||||
centos-70-x64:
|
||||
roles:
|
||||
- master
|
||||
platform: el-7-x86_64
|
||||
hypervisor : none
|
||||
ip: 127.0.0.1
|
||||
CONFIG:
|
||||
type: foss
|
9
spec/acceptance/nodesets/nodepool-trusty.yml
Normal file
9
spec/acceptance/nodesets/nodepool-trusty.yml
Normal file
@ -0,0 +1,9 @@
|
||||
HOSTS:
|
||||
ubuntu-server-1404-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-1404-x64:
|
||||
roles:
|
||||
- master
|
||||
platform: ubuntu-14.04-amd64
|
||||
hypervisor : none
|
||||
ip: 127.0.0.1
|
||||
CONFIG:
|
||||
type: foss
|
11
spec/acceptance/nodesets/ubuntu-server-1404-x64.yml
Normal file
11
spec/acceptance/nodesets/ubuntu-server-1404-x64.yml
Normal file
@ -0,0 +1,11 @@
|
||||
HOSTS:
|
||||
ubuntu-server-1404-x64:
|
||||
roles:
|
||||
- master
|
||||
platform: ubuntu-14.04-amd64
|
||||
box : trusty-server-cloudimg-amd64-vagrant-disk1
|
||||
box_url : puppetlabs/ubuntu-14.04-64-nocm
|
||||
hypervisor : vagrant
|
||||
CONFIG:
|
||||
log_level : debug
|
||||
type: git
|
46
spec/spec_helper_acceptance.rb
Normal file
46
spec/spec_helper_acceptance.rb
Normal file
@ -0,0 +1,46 @@
|
||||
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
|
||||
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', '--force', 'puppetlabs-mysql', '--version', '3.2.0'), { :acceptable_exit_codes => [0,1] }
|
||||
on host, puppet('module','install','dprince/qpid'), { :acceptable_exit_codes => [0,1] }
|
||||
on host, puppet('module','install','puppetlabs-inifile'), { :acceptable_exit_codes => [0,1] }
|
||||
on host, puppet('module','install','puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] }
|
||||
on host, puppet('module','install','puppetlabs-rabbitmq'), { :acceptable_exit_codes => [0,1] }
|
||||
on host, puppet('module','install','stahnma-epel'), { :acceptable_exit_codes => [0,1] }
|
||||
|
||||
# install puppet modules from git, use master
|
||||
shell('git clone https://git.openstack.org/stackforge/puppet-openstacklib /etc/puppet/modules/openstacklib')
|
||||
shell('git clone https://git.openstack.org/stackforge/puppet-keystone /etc/puppet/modules/keystone')
|
||||
|
||||
# Install the module being tested
|
||||
puppet_module_install(:source => proj_root, :module_name => 'glance')
|
||||
# List modules installed to help with debugging
|
||||
on hosts[0], puppet('module','list'), { :acceptable_exit_codes => [0,1] }
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user