Beaker tests
Implement basic structure for beaker tests. Change-Id: I746dc7834b268fc64cd0c65b1388505ae4c20b8d Closes-bug: #1444736
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -15,6 +15,7 @@ group :development, :test do
|
|||||||
gem 'puppet-lint-variable_contains_upcase'
|
gem 'puppet-lint-variable_contains_upcase'
|
||||||
gem 'puppet-lint-numericvariable'
|
gem 'puppet-lint-numericvariable'
|
||||||
|
|
||||||
|
gem 'beaker-rspec', '~> 2.2.4', :require => false
|
||||||
gem 'json'
|
gem 'json'
|
||||||
gem 'webmock'
|
gem 'webmock'
|
||||||
end
|
end
|
||||||
|
12
README.md
12
README.md
@@ -109,6 +109,18 @@ The following platforms are supported:
|
|||||||
* RHEL 6
|
* RHEL 6
|
||||||
* Fedora 18
|
* Fedora 18
|
||||||
|
|
||||||
|
Beaker-Rspec
|
||||||
|
------------
|
||||||
|
|
||||||
|
This module has beaker-rspec tests
|
||||||
|
|
||||||
|
To run:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
bundle install
|
||||||
|
bundle exec rspec spec/acceptance
|
||||||
|
```
|
||||||
|
|
||||||
Development
|
Development
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
110
spec/acceptance/basic_neutron_spec.rb
Normal file
110
spec/acceptance/basic_neutron_spec.rb
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
require 'spec_helper_acceptance'
|
||||||
|
|
||||||
|
describe 'basic neutron' do
|
||||||
|
|
||||||
|
context 'default parameters' do
|
||||||
|
|
||||||
|
it 'should work with no errors' do
|
||||||
|
pp= <<-EOS
|
||||||
|
Exec { logoutput => 'on_failure' }
|
||||||
|
|
||||||
|
include ::apt
|
||||||
|
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': }
|
||||||
|
|
||||||
|
class { '::rabbitmq':
|
||||||
|
delete_guest_user => true,
|
||||||
|
erlang_cookie => 'secrete',
|
||||||
|
}
|
||||||
|
|
||||||
|
rabbitmq_vhost { '/':
|
||||||
|
provider => 'rabbitmqctl',
|
||||||
|
require => Class['rabbitmq'],
|
||||||
|
}
|
||||||
|
|
||||||
|
rabbitmq_user { 'neutron':
|
||||||
|
admin => true,
|
||||||
|
password => 'an_even_bigger_secret',
|
||||||
|
provider => 'rabbitmqctl',
|
||||||
|
require => Class['rabbitmq'],
|
||||||
|
}
|
||||||
|
|
||||||
|
rabbitmq_user_permissions { 'neutron@/':
|
||||||
|
configure_permission => '.*',
|
||||||
|
write_permission => '.*',
|
||||||
|
read_permission => '.*',
|
||||||
|
provider => 'rabbitmqctl',
|
||||||
|
require => Class['rabbitmq'],
|
||||||
|
}
|
||||||
|
|
||||||
|
# Keystone resources, needed by Neutron 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/",
|
||||||
|
}
|
||||||
|
|
||||||
|
# Neutron resources
|
||||||
|
class { '::neutron':
|
||||||
|
rabbit_user => 'neutron',
|
||||||
|
rabbit_password => 'an_even_bigger_secret',
|
||||||
|
rabbit_host => '127.0.0.1',
|
||||||
|
allow_overlapping_ips => true,
|
||||||
|
core_plugin => 'neutron.plugins.ml2.plugin.Ml2Plugin',
|
||||||
|
}
|
||||||
|
class { '::neutron::db::mysql':
|
||||||
|
password => 'a_big_secret',
|
||||||
|
}
|
||||||
|
class { '::neutron::keystone::auth':
|
||||||
|
password => 'a_big_secret',
|
||||||
|
}
|
||||||
|
class { '::neutron::server':
|
||||||
|
database_connection => 'mysql://neutron:a_big_secret@127.0.0.1/neutron?charset=utf8',
|
||||||
|
auth_password => 'a_big_secret',
|
||||||
|
identity_uri => 'http://127.0.0.1:35357/',
|
||||||
|
}
|
||||||
|
class { '::neutron::client': }
|
||||||
|
class { '::neutron::quota': }
|
||||||
|
class { '::neutron::agents::dhcp': }
|
||||||
|
class { '::neutron::agents::l3': }
|
||||||
|
class { '::neutron::agents::lbaas': }
|
||||||
|
class { '::neutron::agents::metering': }
|
||||||
|
class { '::neutron::agents::ml2::ovs':
|
||||||
|
enable_tunneling => true,
|
||||||
|
local_ip => '127.0.0.1',
|
||||||
|
}
|
||||||
|
class { '::neutron::plugins::ml2': }
|
||||||
|
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
|
47
spec/spec_helper_acceptance.rb
Normal file
47
spec/spec_helper_acceptance.rb
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
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','dprince/qpid'), { :acceptable_exit_codes => 0 }
|
||||||
|
on host, puppet('module','install','duritong/sysctl'), { :acceptable_exit_codes => 0 }
|
||||||
|
on host, puppet('module','install','puppetlabs-inifile'), { :acceptable_exit_codes => 0 }
|
||||||
|
on host, puppet('module','install','stahnma-epel'), { :acceptable_exit_codes => 0 }
|
||||||
|
on host, puppet('module','install','puppetlabs-rabbitmq'), { :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-vswitch /etc/puppet/modules/vswitch')
|
||||||
|
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 => 'neutron')
|
||||||
|
# List modules installed to help with debugging
|
||||||
|
on hosts[0], puppet('module','list'), { :acceptable_exit_codes => 0 }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Reference in New Issue
Block a user