diff options
-rwxr-xr-x | ci/verify-chef.bat | 16 | ||||
-rwxr-xr-x | ci/verify-chef.sh | 9 |
2 files changed, 25 insertions, 0 deletions
diff --git a/ci/verify-chef.bat b/ci/verify-chef.bat index c8f9d3573c..30918b2900 100755 --- a/ci/verify-chef.bat +++ b/ci/verify-chef.bat @@ -11,6 +11,18 @@ SET EMBEDDED_BIN_DIR=C:\opscode\%PROJECT_NAME%\embedded\bin ECHO. +REM ; Set the temporary directory to a custom location, and wipe it before +REM ; and after the tests run. +IF %TEMP% ( + SET TEMP=%TEMP%\cheftest + SET TMP=%TMP%\cheftest +) ELSE ( + SET TEMP=%TEMP%\cheftest + SET TMP=%TMP%\cheftest +) +RMDIR /S /Q %TEMP% +MKDIR %TEMP% + FOR %%b IN ( chef-client knife @@ -51,3 +63,7 @@ IF "%PIPELINE_NAME%" == "chef-fips" ( set CHEF_FIPS=1 ) call bundle exec rspec -r rspec_junit_formatter -f RspecJunitFormatter -o %WORKSPACE%\test.xml -f documentation spec/unit spec/functional + +REM ; Destroy everything at the end for good measure. +RMDIR /S /Q %TEMP% +MKDIR %TEMP% diff --git a/ci/verify-chef.sh b/ci/verify-chef.sh index 0c8ca768f7..117bf6b642 100755 --- a/ci/verify-chef.sh +++ b/ci/verify-chef.sh @@ -1,5 +1,11 @@ #!/bin/sh +# Set up a custom tmpdir, and clean it up before and after the tests +TMPDIR="${TMPDIR:-/tmp}/cheftest" +export TMPDIR +rm -rf $TMPDIR +mkdir -p $TMPDIR + # $PROJECT_NAME is set by Jenkins, this allows us to use the same script to verify # Chef and Angry Chef PATH=/opt/$PROJECT_NAME/bin:$PATH @@ -107,3 +113,6 @@ else fi sudo env PATH=$PATH TERM=xterm CHEF_FIPS=$CHEF_FIPS bundle exec rspec -r rspec_junit_formatter -f RspecJunitFormatter -o $WORKSPACE/test.xml -f documentation spec/functional spec/unit fi + +# Clean up the tmpdir at the end for good measure. +rm -rf $TMPDIR |