Beaker tests

Implement basic structure for beaker tests.

Change-Id: Ia8533ffacf8aab27010496fab744a2490a5b8f53
Closes-bug: #1444736
This commit is contained in:
Emilien Macchi 2015-04-28 09:33:46 -04:00
parent 9b9636b6f5
commit 58e807a42c
6 changed files with 95 additions and 0 deletions

View File

@ -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

View File

@ -30,6 +30,17 @@ vs_port { 'eth2':
}
```
## Beaker-Rspec
This module has beaker-rspec tests
To run:
``shell
bundle install
bundle exec rspec spec/acceptance
``
## TODO:
* OpenFlow controller settings
* OpenFlow Settings

View File

@ -0,0 +1,28 @@
require 'spec_helper_acceptance'
describe 'basic vswitch' do
context 'default parameters' do
it 'should work with no errors' do
pp= <<-EOS
Exec { logoutput => 'on_failure' }
include ::vswitch::ovs
vs_bridge { 'br-beaker':
ensure => present,
}
EOS
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
describe command('ovs-vsctl show') do
its(:stdout) { should match /br-beaker/ }
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,37 @@
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-stdlib'), { :acceptable_exit_codes => 0 }
# Install the module being tested
puppet_module_install(:source => proj_root, :module_name => 'vswitch')
# List modules installed to help with debugging
on hosts[0], puppet('module','list'), { :acceptable_exit_codes => 0 }
end
end
end