From 63dd9afb7aee3c7d1aa61a036e313c4d74f683fe Mon Sep 17 00:00:00 2001 From: Kartik Null Cating-Subramanian Date: Thu, 21 Apr 2016 18:57:27 -0400 Subject: Split the unit and integration tests to parallelize them --- acceptance/fips/.kitchen.yml | 6 ++- .../fips-integration/serverspec/Gemfile | 3 ++ .../serverspec/fips-integration_spec.rb | 51 +++++++++++++++++++ .../fips-unit-functional/serverspec/Gemfile | 3 ++ .../serverspec/fips-unit-functional_spec.rb | 56 ++++++++++++++++++++ .../fips/test/integration/fips/serverspec/Gemfile | 3 -- .../test/integration/fips/serverspec/fips_spec.rb | 59 ---------------------- 7 files changed, 118 insertions(+), 63 deletions(-) create mode 100644 acceptance/fips/test/integration/fips-integration/serverspec/Gemfile create mode 100644 acceptance/fips/test/integration/fips-integration/serverspec/fips-integration_spec.rb create mode 100644 acceptance/fips/test/integration/fips-unit-functional/serverspec/Gemfile create mode 100644 acceptance/fips/test/integration/fips-unit-functional/serverspec/fips-unit-functional_spec.rb delete mode 100644 acceptance/fips/test/integration/fips/serverspec/Gemfile delete mode 100644 acceptance/fips/test/integration/fips/serverspec/fips_spec.rb (limited to 'acceptance') diff --git a/acceptance/fips/.kitchen.yml b/acceptance/fips/.kitchen.yml index 946401a738..23280f9142 100644 --- a/acceptance/fips/.kitchen.yml +++ b/acceptance/fips/.kitchen.yml @@ -1,4 +1,8 @@ suites: - - name: fips + - name: fips-unit-functional + includes: [centos-6, windows-2012r2] + run_list: + + - name: fips-integration includes: [centos-6, windows-2012r2] run_list: diff --git a/acceptance/fips/test/integration/fips-integration/serverspec/Gemfile b/acceptance/fips/test/integration/fips-integration/serverspec/Gemfile new file mode 100644 index 0000000000..3921e6a92a --- /dev/null +++ b/acceptance/fips/test/integration/fips-integration/serverspec/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem "mixlib-shellout" diff --git a/acceptance/fips/test/integration/fips-integration/serverspec/fips-integration_spec.rb b/acceptance/fips/test/integration/fips-integration/serverspec/fips-integration_spec.rb new file mode 100644 index 0000000000..59a888bef1 --- /dev/null +++ b/acceptance/fips/test/integration/fips-integration/serverspec/fips-integration_spec.rb @@ -0,0 +1,51 @@ +require "mixlib/shellout" +require "bundler" + +describe "Chef Fips Integration Specs" do + def windows? + if RUBY_PLATFORM =~ /mswin|mingw|windows/ + true + else + false + end + end + + let(:omnibus_root) do + if windows? + "c:/opscode/chef" + else + "/opt/chef" + end + end + + let(:env) do + { + "PATH" => [ "#{omnibus_root}/embedded/bin", ENV["PATH"] ].join(File::PATH_SEPARATOR), + "BUNDLE_GEMFILE" => "#{omnibus_root}/Gemfile", + "GEM_PATH" => nil, "GEM_CACHE" => nil, "GEM_HOME" => nil, + "BUNDLE_IGNORE_CONFIG" => "true", + "BUNDLE_FROZEN" => "1", + "CHEF_FIPS" => "1" + } + end + + let(:chef_dir) do + cmd = Mixlib::ShellOut.new("bundle show chef", env: env).run_command + cmd.error! + cmd.stdout.chomp + end + + def run_rspec_test(test) + Bundler.with_clean_env do + cmd = Mixlib::ShellOut.new( + "bundle exec rspec -f documentation -t ~requires_git #{test}", + env: env, cwd: chef_dir, timeout: 3600 + ) + cmd.run_command.error! + end + end + + it "passes the integration specs" do + run_rspec_test("spec/integration") + end +end diff --git a/acceptance/fips/test/integration/fips-unit-functional/serverspec/Gemfile b/acceptance/fips/test/integration/fips-unit-functional/serverspec/Gemfile new file mode 100644 index 0000000000..3921e6a92a --- /dev/null +++ b/acceptance/fips/test/integration/fips-unit-functional/serverspec/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem "mixlib-shellout" diff --git a/acceptance/fips/test/integration/fips-unit-functional/serverspec/fips-unit-functional_spec.rb b/acceptance/fips/test/integration/fips-unit-functional/serverspec/fips-unit-functional_spec.rb new file mode 100644 index 0000000000..446261f83f --- /dev/null +++ b/acceptance/fips/test/integration/fips-unit-functional/serverspec/fips-unit-functional_spec.rb @@ -0,0 +1,56 @@ +require "mixlib/shellout" +require "bundler" + +describe "Chef Fips Unit/Functional Specs" do + def windows? + if RUBY_PLATFORM =~ /mswin|mingw|windows/ + true + else + false + end + end + + let(:omnibus_root) do + if windows? + "c:/opscode/chef" + else + "/opt/chef" + end + end + + let(:env) do + { + "PATH" => [ "#{omnibus_root}/embedded/bin", ENV["PATH"] ].join(File::PATH_SEPARATOR), + "BUNDLE_GEMFILE" => "#{omnibus_root}/Gemfile", + "GEM_PATH" => nil, "GEM_CACHE" => nil, "GEM_HOME" => nil, + "BUNDLE_IGNORE_CONFIG" => "true", + "BUNDLE_FROZEN" => "1", + "CHEF_FIPS" => "1" + } + end + + let(:chef_dir) do + cmd = Mixlib::ShellOut.new("bundle show chef", env: env).run_command + cmd.error! + cmd.stdout.chomp + end + + def run_rspec_test(test) + Bundler.with_clean_env do + cmd = Mixlib::ShellOut.new( + "bundle exec rspec -f documentation -t ~requires_git #{test}", + env: env, cwd: chef_dir, timeout: 3600 + ) + cmd.run_command.error! + end + end + + it "passes the unit specs" do + run_rspec_test("spec/unit") + end + + it "passes the functional specs" do + run_rspec_test("spec/functional") + end + +end diff --git a/acceptance/fips/test/integration/fips/serverspec/Gemfile b/acceptance/fips/test/integration/fips/serverspec/Gemfile deleted file mode 100644 index 3921e6a92a..0000000000 --- a/acceptance/fips/test/integration/fips/serverspec/Gemfile +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 9bf0db1cd9..0000000000 --- a/acceptance/fips/test/integration/fips/serverspec/fips_spec.rb +++ /dev/null @@ -1,59 +0,0 @@ -require "mixlib/shellout" -require "bundler" - -describe "Chef Fips Specs" do - def windows? - if RUBY_PLATFORM =~ /mswin|mingw|windows/ - true - else - false - end - end - - let(:omnibus_root) do - if windows? - "c:/opscode/chef" - else - "/opt/chef" - end - end - - let(:env) do - { - "PATH" => [ "#{omnibus_root}/embedded/bin", ENV["PATH"] ].join(File::PATH_SEPARATOR), - "BUNDLE_GEMFILE" => "#{omnibus_root}/Gemfile", - "GEM_PATH" => nil, "GEM_CACHE" => nil, "GEM_HOME" => nil, - "BUNDLE_IGNORE_CONFIG" => "true", - "BUNDLE_FROZEN" => "1", - "CHEF_FIPS" => "1" - } - end - - let(:chef_dir) do - cmd = Mixlib::ShellOut.new("bundle show chef", env: env).run_command - cmd.error! - cmd.stdout.chomp - end - - def run_rspec_test(test) - Bundler.with_clean_env do - cmd = Mixlib::ShellOut.new( - "bundle exec rspec -f documentation -t ~requires_git #{test}", - env: env, cwd: chef_dir, timeout: 3600 - ) - cmd.run_command.error! - end - end - - it "passes the unit specs" do - run_rspec_test("spec/unit") - end - - it "passes the functional specs" do - run_rspec_test("spec/functional") - end - - it "passes the integration specs" do - run_rspec_test("spec/integration") - end -end -- cgit v1.2.1