Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit f4c0459cd5224819df9826567bd5f39916f2351f 1 parent 03f9f90
@bodepd bodepd authored bodepd committed
View
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
View
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
View
1  spec/spec_helper.rb
@@ -0,0 +1 @@
+require 'puppetlabs_spec_helper/module_spec_helper'
View
17 test_scripts/openstack_test.sh
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.