add support for running all unit tests
this commit adds a rake test that supports running all unit tests. it also updates the openstack_test.sh script to invoke that rake test to run tests. Also, it adds unit testing requirements to the Gemfile.
This commit is contained in:
6
Gemfile
6
Gemfile
@@ -2,3 +2,9 @@ source "https://rubygems.org"
|
||||
gem "vagrant", "~>1.0"
|
||||
gem "librarian-puppet"
|
||||
gem "github_api", "0.8.1"
|
||||
gem 'rake'
|
||||
group :unit_tests do
|
||||
gem 'puppetlabs_spec_helper'
|
||||
gem 'puppet', '3.1.0'
|
||||
gem 'rspec-puppet'
|
||||
end
|
||||
|
||||
13
Rakefile
13
Rakefile
@@ -157,6 +157,19 @@ end
|
||||
|
||||
namespace :test do
|
||||
|
||||
desc 'run openstack puppet module unit tests'
|
||||
task :unit do
|
||||
status = command = "export MODULEPATH=#{base_dir}/modules;export GEM_HOME=#{base_dir}/.vendor;"
|
||||
['cinder', 'nova', 'glance', 'openstack', 'keystone', 'horizon', 'swift'].collect do |proj|
|
||||
Dir.chdir("modules/#{proj}") do
|
||||
local_command = command + "bundle exec rake spec_standalone"
|
||||
puts local_command
|
||||
system(local_command)
|
||||
end
|
||||
end.uniq
|
||||
status == ['true'] ? exit(0) : exit(1)
|
||||
end
|
||||
|
||||
desc 'reset test environment'
|
||||
task :reset do
|
||||
refresh_modules
|
||||
|
||||
1
spec/spec_helper.rb
Normal file
1
spec/spec_helper.rb
Normal file
@@ -0,0 +1 @@
|
||||
require 'puppetlabs_spec_helper/module_spec_helper'
|
||||
@@ -28,7 +28,13 @@ elif [ $module_install_method = 'pmt' ]; then
|
||||
git clone git://github.com/puppetlabs/puppetlabs-tempest modules/tempest
|
||||
git clone git://github.com/puppetlabs/puppetlabs-vcsrepo modules/vcsrepo
|
||||
fi
|
||||
# install a controller and compute instance
|
||||
|
||||
# install gem dependencies
|
||||
mkdir .vendor
|
||||
export GEM_HOME=`pwd`/.vendor
|
||||
# install gem dependencies
|
||||
bundle install
|
||||
|
||||
|
||||
# only build out integration test environment if we are not running unit tests
|
||||
if [ ! $test_mode = 'unit' ]; then
|
||||
@@ -40,12 +46,7 @@ if [ ! $test_mode = 'unit' ]; then
|
||||
echo 'openstack_version: folsom' > hiera_data/jenkins.yaml
|
||||
fi
|
||||
|
||||
# install gem dependencies
|
||||
mkdir .vendor
|
||||
export GEM_HOME=`pwd`/.vendor
|
||||
# install gem dependencies
|
||||
bundle install
|
||||
|
||||
# install a controller and compute instance
|
||||
# check that the VM is not currently running
|
||||
# if it is, stop that VM
|
||||
if VBoxManage list vms | grep openstack_controller.puppetlabs.lan; then
|
||||
@@ -75,7 +76,7 @@ elif [ $test_mode = 'tempest_smoke' ]; then
|
||||
elif [ $test_mode = 'tempest_full' ]; then
|
||||
bundle exec vagrant ssh -c 'cd /var/lib/tempest/;sudo ./jenkins_launch_script.sh;' openstack_controller
|
||||
elif [ $test_mode = 'unit' ]; then
|
||||
echo 'we do not yet support running unit tests'
|
||||
bundle exec rake test:unit
|
||||
else
|
||||
echo "Unsupported testnode ${test_mode}, this test matrix only support tempest_smoke and puppet_openstack tests"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user