summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth Chisamore <schisamo@getchef.com>2014-06-11 00:58:31 -0500
committerSeth Chisamore <schisamo@getchef.com>2014-06-11 00:58:31 -0500
commitedb4db02546c30e3318b61205b7e6f29ef0b9f13 (patch)
treefc3ddb2b7d68ee86fbe365f9af9a61b524c8f237
parent28dffd6db75adc4c6b05bd22fc2d1f0571a62446 (diff)
parentfcac68e3f1d0ca259f019e87871b23f5a7b75570 (diff)
downloadohai-edb4db02546c30e3318b61205b7e6f29ef0b9f13.tar.gz
Merge pull request #338 from opscode/schisamo/execute-with-sudo
Only execute tests with elevated privileges
-rwxr-xr-xci/jenkins_run_tests.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/ci/jenkins_run_tests.sh b/ci/jenkins_run_tests.sh
index 5bf7def0..69dd052c 100755
--- a/ci/jenkins_run_tests.sh
+++ b/ci/jenkins_run_tests.sh
@@ -5,8 +5,12 @@ export PATH=$PATH:/usr/local/bin
ruby -v;
# remove the Gemfile.lock and try again if bundler fails.
# This should take care of Gemfile changes that result in "bad" bundles without forcing us to rebundle every time
-bundle install --without docgen --path vendor/bundle || ( rm Gemfile.lock && bundle install --path vendor/bundle )
-bundle exec rspec -r rspec_junit_formatter -f RspecJunitFormatter -o test.xml -f documentation spec;
+bundle install --binstubs --without docgen --path vendor/bundle || ( rm Gemfile.lock && bundle install --path vendor/bundle )
+# preserve the environment and $PATH of the `jenkins` user
+sudo -E bash -c "export PATH=$PATH && bin/rspec -r rspec_junit_formatter -f RspecJunitFormatter -o test.xml -f documentation spec"
+# Ensure Jenkins can clean this file up
+sudo chown $USER test.xml
+
RSPEC_RETURNCODE=$?
# exit with the result of running rspec