diff options
author | Serdar Sutay <serdar@opscode.com> | 2016-01-12 12:30:51 -0800 |
---|---|---|
committer | Serdar Sutay <serdar@opscode.com> | 2016-01-27 23:04:16 -0800 |
commit | 135d0c3f54d38a648647e289f8303c6316f44099 (patch) | |
tree | 6bcf5c12af949ea368ffede59ba84ab8df66cfe3 /ci | |
parent | f0a0b3cdd1674dbf138e71fd1fb64939bad057df (diff) | |
download | chef-135d0c3f54d38a648647e289f8303c6316f44099.tar.gz |
Make sure acceptance tests for chef can run in Jenkins.sersut/ec2-acceptance
Diffstat (limited to 'ci')
-rwxr-xr-x | ci/verify-chef.sh | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/ci/verify-chef.sh b/ci/verify-chef.sh index f0d174084a..074a110134 100755 --- a/ci/verify-chef.sh +++ b/ci/verify-chef.sh @@ -75,21 +75,35 @@ $EMBEDDED_BIN_DIR/rspec --version FORCE_FFI_YAJL=ext export FORCE_FFI_YAJL -PATH=/opt/$PROJECT_NAME/bin:/opt/$PROJECT_NAME/embedded/bin:$PATH -export PATH - -# Test against the vendored Chef gem -cd /opt/$PROJECT_NAME/embedded/lib/ruby/gems/*/gems/chef-[0-9]* - -if [ ! -f "Gemfile.lock" ]; then - echo "Chef gem does not contain a Gemfile.lock! This is needed to run any tests." - exit 1 -fi - -unset CHEF_FIPS -if [ "$PIPELINE_NAME" = "chef-fips" ]; then - echo "Setting fips mode" - CHEF_FIPS=1 - export CHEF_FIPS +# ACCEPTANCE environment variable will be set on acceptance testers. +# If is it set; we run the acceptance tests, otherwise run rspec tests. +if [ "x$ACCEPTANCE" != "x" ]; then + # On acceptance testers we have Chef DK. We will use its Ruby environment + # to cut down the gem installation time. + PATH=/opt/chefdk/bin:/opt/chefdk/embedded/bin:$PATH + export PATH + + # Test against the vendored Chef gem + cd /opt/$PROJECT_NAME/embedded/lib/ruby/gems/*/gems/chef-[0-9]*/acceptance + sudo env PATH=$PATH AWS_SSH_KEY_ID=$AWS_SSH_KEY_ID ARTIFACTORY_USERNAME=$ARTIFACTORY_USERNAME ARTIFACTORY_PASSWORD=$ARTIFACTORY_PASSWORD bundle install + sudo env PATH=$PATH AWS_SSH_KEY_ID=$AWS_SSH_KEY_ID ARTIFACTORY_USERNAME=$ARTIFACTORY_USERNAME ARTIFACTORY_PASSWORD=$ARTIFACTORY_PASSWORD KITCHEN_DRIVER=ec2 bundle exec chef-acceptance test cookbook-git +else + PATH=/opt/$PROJECT_NAME/bin:/opt/$PROJECT_NAME/embedded/bin:$PATH + export PATH + + # Test against the vendored Chef gem + cd /opt/$PROJECT_NAME/embedded/lib/ruby/gems/*/gems/chef-[0-9]* + + if [ ! -f "Gemfile.lock" ]; then + echo "Chef gem does not contain a Gemfile.lock! This is needed to run any tests." + exit 1 + fi + + unset CHEF_FIPS + if [ "$PIPELINE_NAME" = "chef-fips" ]; then + echo "Setting fips mode" + CHEF_FIPS=1 + export CHEF_FIPS + 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 -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 |