Beaker tests
Implement basic structure for beaker tests. Change-Id: I3ff1f74115be8029bffc0eb9f11e09cbd4cd74a9 Closes-bug: #1444736
This commit is contained in:
parent
76d9827938
commit
59b47a29d1
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
@ -235,6 +235,18 @@ Limitations
|
||||
|
||||
* No explicit support external NAS devices (i.e. Nexenta and LFS) to offload the ring replication requirements.
|
||||
|
||||
Beaker-Rspec
|
||||
------------
|
||||
|
||||
This module has beaker-rspec tests
|
||||
|
||||
To run:
|
||||
|
||||
``shell
|
||||
bundle install
|
||||
bundle exec rspec spec/acceptance
|
||||
``
|
||||
|
||||
Development
|
||||
-----------
|
||||
|
||||
|
113
spec/acceptance/basic_swift_spec.rb
Normal file
113
spec/acceptance/basic_swift_spec.rb
Normal file
@ -0,0 +1,113 @@
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'basic swift' do
|
||||
|
||||
context 'default parameters' do
|
||||
|
||||
it 'should work with no errors' do
|
||||
pp= <<-EOS
|
||||
Exec { logoutput => 'on_failure' }
|
||||
|
||||
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,
|
||||
} ~>
|
||||
exec { '/usr/bin/apt-get -y dist-upgrade':
|
||||
refreshonly => true,
|
||||
}
|
||||
Apt::Source['trusty-updates-kilo'] -> Package<| |>
|
||||
|
||||
class { '::mysql::server': }
|
||||
|
||||
package { 'curl': ensure => present }
|
||||
|
||||
class { '::memcached':
|
||||
listen_ip => '127.0.0.1',
|
||||
}
|
||||
|
||||
# Keystone resources, needed by Swift to run
|
||||
class { '::keystone::db::mysql':
|
||||
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/",
|
||||
}
|
||||
|
||||
# Swift resources
|
||||
class { '::swift':
|
||||
# not sure how I want to deal with this shared secret
|
||||
swift_hash_suffix => 'secrete',
|
||||
package_ensure => latest,
|
||||
}
|
||||
class { '::swift::keystone::auth':
|
||||
password => 'a_big_secret',
|
||||
}
|
||||
# === Configure Storage
|
||||
class { '::swift::storage':
|
||||
storage_local_net_ip => '127.0.0.1',
|
||||
}
|
||||
# create xfs partitions on a loopback device and mounts them
|
||||
swift::storage::loopback { '2':
|
||||
require => Class['swift'],
|
||||
}
|
||||
# sets up storage nodes which is composed of a single
|
||||
# device that contains an endpoint for an object, account, and container
|
||||
swift::storage::node { '2':
|
||||
mnt_base_dir => '/srv/node',
|
||||
weight => 1,
|
||||
manage_ring => true,
|
||||
zone => '2',
|
||||
storage_local_net_ip => '127.0.0.1',
|
||||
require => Swift::Storage::Loopback[2] ,
|
||||
}
|
||||
class { '::swift::ringbuilder':
|
||||
part_power => '18',
|
||||
replicas => '1',
|
||||
min_part_hours => 1,
|
||||
require => Class['swift'],
|
||||
}
|
||||
class { '::swift::proxy':
|
||||
proxy_local_net_ip => '127.0.0.1',
|
||||
pipeline => ['healthcheck', 'cache', 'tempauth', 'proxy-server'],
|
||||
account_autocreate => true,
|
||||
require => Class['swift::ringbuilder'],
|
||||
}
|
||||
class { '::swift::proxy::authtoken':
|
||||
admin_password => 'a_big_secret',
|
||||
}
|
||||
class { ['::swift::proxy::healthcheck', '::swift::proxy::cache', '::swift::proxy::tempauth']: }
|
||||
EOS
|
||||
|
||||
|
||||
# Need to be run 2 times because we have an exported when creating the ring.
|
||||
apply_manifest(pp, :catch_failures => false)
|
||||
apply_manifest(pp, :catch_failures => true)
|
||||
# The third run tests idempotency
|
||||
apply_manifest(pp, :catch_changes => true)
|
||||
end
|
||||
|
||||
describe port(8080) do
|
||||
it { is_expected.to be_listening.with('tcp') }
|
||||
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
|
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 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-mysql'), { :acceptable_exit_codes => 0 }
|
||||
on host, puppet('module','install','puppetlabs-apt', '--version', '1.8.0'), { :acceptable_exit_codes => 0 }
|
||||
on host, puppet('module','install','puppetlabs-inifile'), { :acceptable_exit_codes => 0 }
|
||||
on host, puppet('module','install','puppetlabs-rsync'), { :acceptable_exit_codes => 0 }
|
||||
on host, puppet('module','install','saz-memcached'), { :acceptable_exit_codes => 0 }
|
||||
on host, puppet('module','install','stahnma-epel'), { :acceptable_exit_codes => 0 }
|
||||
|
||||
# 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 => 'swift')
|
||||
# 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