summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerdar Sutay <serdar@opscode.com>2016-01-12 12:30:51 -0800
committerSerdar Sutay <serdar@opscode.com>2016-01-27 23:04:16 -0800
commit135d0c3f54d38a648647e289f8303c6316f44099 (patch)
tree6bcf5c12af949ea368ffede59ba84ab8df66cfe3
parentf0a0b3cdd1674dbf138e71fd1fb64939bad057df (diff)
downloadchef-135d0c3f54d38a648647e289f8303c6316f44099.tar.gz
Make sure acceptance tests for chef can run in Jenkins.sersut/ec2-acceptance
-rw-r--r--acceptance/.gitignore1
-rw-r--r--acceptance/cookbook-git/.kitchen.ec2.yml2
-rw-r--r--chef.gemspec2
-rwxr-xr-xci/verify-chef.sh48
4 files changed, 34 insertions, 19 deletions
diff --git a/acceptance/.gitignore b/acceptance/.gitignore
new file mode 100644
index 0000000000..66f8ed35a4
--- /dev/null
+++ b/acceptance/.gitignore
@@ -0,0 +1 @@
+/Gemfile.lock
diff --git a/acceptance/cookbook-git/.kitchen.ec2.yml b/acceptance/cookbook-git/.kitchen.ec2.yml
index e140d9ea8a..ba323aa65f 100644
--- a/acceptance/cookbook-git/.kitchen.ec2.yml
+++ b/acceptance/cookbook-git/.kitchen.ec2.yml
@@ -301,4 +301,4 @@ provisioner:
name: chef_zero
product_name: chef
product_version: latest
- channel: current
+ channel: unstable
diff --git a/chef.gemspec b/chef.gemspec
index e50ef6c744..838df04803 100644
--- a/chef.gemspec
+++ b/chef.gemspec
@@ -55,5 +55,5 @@ Gem::Specification.new do |s|
s.executables = %w{ chef-client chef-solo knife chef-shell chef-apply }
s.require_paths = %w{ lib lib-backcompat }
- s.files = %w{Gemfile Rakefile LICENSE README.md CONTRIBUTING.md} + Dir.glob("{distro,lib,lib-backcompat,tasks,spec}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) } + Dir.glob("*.gemspec")
+ s.files = %w{Gemfile Rakefile LICENSE README.md CONTRIBUTING.md} + Dir.glob("{distro,lib,lib-backcompat,tasks,acceptance,spec}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) } + Dir.glob("*.gemspec")
end
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