summaryrefslogtreecommitdiff
path: root/ci/verify-chef.sh
diff options
context:
space:
mode:
Diffstat (limited to 'ci/verify-chef.sh')
-rwxr-xr-xci/verify-chef.sh48
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