summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKartik Null Cating-Subramanian <ksubramanian@chef.io>2016-02-26 18:12:53 -0500
committerKartik Null Cating-Subramanian <ksubramanian@chef.io>2016-02-26 18:12:53 -0500
commitf88ccdbea8a62d6488a77016a08a4a45b918f138 (patch)
tree78072c0942346101f414e701bf752e2781bed0a1
parentbea0bdf39b421c62f30a86f29e67210e456799c6 (diff)
parent7f59d1bd2043ea183fd3287c291edb7376303340 (diff)
downloadchef-f88ccdbea8a62d6488a77016a08a4a45b918f138.tar.gz
Merge pull request #4620 from chef/jdm/fips-acceptance
Add acceptance tests for running chef-client with the FIPS mode
-rw-r--r--acceptance/.shared/kitchen_acceptance/.kitchen.vagrant.yml5
-rw-r--r--acceptance/Gemfile4
-rw-r--r--acceptance/fips/.acceptance/acceptance-cookbook/.gitignore2
-rw-r--r--acceptance/fips/.acceptance/acceptance-cookbook/metadata.rb2
-rw-r--r--acceptance/fips/.acceptance/acceptance-cookbook/recipes/destroy.rb1
-rw-r--r--acceptance/fips/.acceptance/acceptance-cookbook/recipes/provision.rb1
-rw-r--r--acceptance/fips/.acceptance/acceptance-cookbook/recipes/verify.rb1
-rw-r--r--acceptance/fips/.kitchen.yml4
-rw-r--r--acceptance/fips/test/integration/fips/serverspec/Gemfile3
-rw-r--r--acceptance/fips/test/integration/fips/serverspec/fips_spec.rb39
-rw-r--r--spec/functional/resource/deploy_revision_spec.rb2
-rw-r--r--spec/functional/resource/git_spec.rb2
12 files changed, 61 insertions, 5 deletions
diff --git a/acceptance/.shared/kitchen_acceptance/.kitchen.vagrant.yml b/acceptance/.shared/kitchen_acceptance/.kitchen.vagrant.yml
index 4cd6b35d69..1d6c7fc037 100644
--- a/acceptance/.shared/kitchen_acceptance/.kitchen.vagrant.yml
+++ b/acceptance/.shared/kitchen_acceptance/.kitchen.vagrant.yml
@@ -38,8 +38,9 @@ fedora-21
# freebsd-8
# ubuntu-12.04
# centos-7
-# centos-6
-
+ - name: centos-6
+ driver:
+ box: bento/centos-6.7
<% %w(
2012r2
2012
diff --git a/acceptance/Gemfile b/acceptance/Gemfile
index 326d769a3d..4573bc5fb3 100644
--- a/acceptance/Gemfile
+++ b/acceptance/Gemfile
@@ -6,7 +6,9 @@ gem "test-kitchen", github: "sersut/test-kitchen", branch: "sersut/mixlib-instal
gem "kitchen-ec2", github: "test-kitchen/kitchen-ec2", branch: "jk/image-search-only"
gem "kitchen-inspec"
gem "inspec"
-gem "kitchen-vagrant"
+# Pinning to github for kitchen-vagrant because 0.19.0 incorrectly
+# puts in a box_url for bento when a vagrant box in atlas is specified
+gem "kitchen-vagrant", github: "test-kitchen/kitchen-vagrant"
gem "windows_chef_zero"
gem "winrm-transport"
gem "berkshelf"
diff --git a/acceptance/fips/.acceptance/acceptance-cookbook/.gitignore b/acceptance/fips/.acceptance/acceptance-cookbook/.gitignore
new file mode 100644
index 0000000000..041413b040
--- /dev/null
+++ b/acceptance/fips/.acceptance/acceptance-cookbook/.gitignore
@@ -0,0 +1,2 @@
+nodes/
+tmp/
diff --git a/acceptance/fips/.acceptance/acceptance-cookbook/metadata.rb b/acceptance/fips/.acceptance/acceptance-cookbook/metadata.rb
new file mode 100644
index 0000000000..6c754560f0
--- /dev/null
+++ b/acceptance/fips/.acceptance/acceptance-cookbook/metadata.rb
@@ -0,0 +1,2 @@
+name "acceptance-cookbook"
+depends "kitchen_acceptance"
diff --git a/acceptance/fips/.acceptance/acceptance-cookbook/recipes/destroy.rb b/acceptance/fips/.acceptance/acceptance-cookbook/recipes/destroy.rb
new file mode 100644
index 0000000000..e2d663ac2f
--- /dev/null
+++ b/acceptance/fips/.acceptance/acceptance-cookbook/recipes/destroy.rb
@@ -0,0 +1 @@
+kitchen "destroy"
diff --git a/acceptance/fips/.acceptance/acceptance-cookbook/recipes/provision.rb b/acceptance/fips/.acceptance/acceptance-cookbook/recipes/provision.rb
new file mode 100644
index 0000000000..5726c0e7b5
--- /dev/null
+++ b/acceptance/fips/.acceptance/acceptance-cookbook/recipes/provision.rb
@@ -0,0 +1 @@
+kitchen "converge"
diff --git a/acceptance/fips/.acceptance/acceptance-cookbook/recipes/verify.rb b/acceptance/fips/.acceptance/acceptance-cookbook/recipes/verify.rb
new file mode 100644
index 0000000000..05ac94ce66
--- /dev/null
+++ b/acceptance/fips/.acceptance/acceptance-cookbook/recipes/verify.rb
@@ -0,0 +1 @@
+kitchen "verify"
diff --git a/acceptance/fips/.kitchen.yml b/acceptance/fips/.kitchen.yml
new file mode 100644
index 0000000000..946401a738
--- /dev/null
+++ b/acceptance/fips/.kitchen.yml
@@ -0,0 +1,4 @@
+suites:
+ - name: fips
+ includes: [centos-6, windows-2012r2]
+ run_list:
diff --git a/acceptance/fips/test/integration/fips/serverspec/Gemfile b/acceptance/fips/test/integration/fips/serverspec/Gemfile
new file mode 100644
index 0000000000..3921e6a92a
--- /dev/null
+++ b/acceptance/fips/test/integration/fips/serverspec/Gemfile
@@ -0,0 +1,3 @@
+source "https://rubygems.org"
+
+gem "mixlib-shellout"
diff --git a/acceptance/fips/test/integration/fips/serverspec/fips_spec.rb b/acceptance/fips/test/integration/fips/serverspec/fips_spec.rb
new file mode 100644
index 0000000000..66380a37f4
--- /dev/null
+++ b/acceptance/fips/test/integration/fips/serverspec/fips_spec.rb
@@ -0,0 +1,39 @@
+require "mixlib/shellout"
+require "bundler"
+
+describe "Chef Fips Specs" do
+ def windows?
+ if RUBY_PLATFORM =~ /mswin|mingw|windows/
+ true
+ else
+ false
+ end
+ end
+
+ let(:chef_dir) do
+ if windows?
+ Dir.glob("c:/opscode/chef/embedded/lib/ruby/gems/*/gems/chef-[0-9]*").last
+ else
+ Dir.glob("/opt/chef/embedded/lib/ruby/gems/*/gems/chef-[0-9]*").last
+ end
+ end
+
+ let(:path) do
+ if windows?
+ 'C:\opscode\chef\embedded\bin'
+ else
+ "/opt/chef/embedded/bin"
+ end
+ end
+
+ it "passes the unit and functional specs" do
+ Bundler.with_clean_env do
+ ruby_cmd = Mixlib::ShellOut.new(
+ "bundle exec rspec -t ~requires_git spec/unit spec/functional", :env => { "PATH" => [ENV["PATH"], path].join(File::PATH_SEPARATOR),
+ "GEM_PATH" => nil, "GEM_CACHE" => nil, "GEM_HOME" => nil,
+ "CHEF_FIPS" => "1" },
+ :live_stream => STDOUT, :cwd => chef_dir, :timeout => 3600)
+ expect { ruby_cmd.run_command.error! }.not_to raise_exception
+ end
+ end
+end
diff --git a/spec/functional/resource/deploy_revision_spec.rb b/spec/functional/resource/deploy_revision_spec.rb
index ee98832180..72eaea3c12 100644
--- a/spec/functional/resource/deploy_revision_spec.rb
+++ b/spec/functional/resource/deploy_revision_spec.rb
@@ -20,7 +20,7 @@ require "spec_helper"
require "tmpdir"
# Deploy relies heavily on symlinks, so it doesn't work on windows.
-describe Chef::Resource::DeployRevision, :unix_only => true do
+describe Chef::Resource::DeployRevision, :unix_only => true, :requires_git => true do
let(:file_cache_path) { Dir.mktmpdir }
let(:deploy_directory) { Dir.mktmpdir }
diff --git a/spec/functional/resource/git_spec.rb b/spec/functional/resource/git_spec.rb
index 92c2dd2074..11a3afdee5 100644
--- a/spec/functional/resource/git_spec.rb
+++ b/spec/functional/resource/git_spec.rb
@@ -22,7 +22,7 @@ require "tmpdir"
require "shellwords"
# Deploy relies heavily on symlinks, so it doesn't work on windows.
-describe Chef::Resource::Git do
+describe Chef::Resource::Git, :requires_git => true do
include Chef::Mixin::ShellOut
let(:file_cache_path) { Dir.mktmpdir }
# Some versions of git complains when the deploy directory is