diff options
author | Tim Smith <tsmith@chef.io> | 2019-05-27 20:17:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-27 20:17:49 -0700 |
commit | de9484f2804884582bb947524f7a9fd6656af7b2 (patch) | |
tree | 26311b75d1985c0ad93eb61103d0c679ed8e4634 /spec | |
parent | 819307636de80266c6eb7e2072839e47f2dd4dbe (diff) | |
parent | aa28c4e17ef1044fda844f4e9fb19f0d8e2469a2 (diff) | |
download | chef-de9484f2804884582bb947524f7a9fd6656af7b2.tar.gz |
Merge pull request #8460 from cc-build/dist_solo_zero
Add distro constants for solo, zero and automate
Diffstat (limited to 'spec')
-rw-r--r-- | spec/functional/event_loggers/windows_eventlog_spec.rb | 10 | ||||
-rw-r--r-- | spec/functional/version_spec.rb | 3 | ||||
-rw-r--r-- | spec/integration/client/client_spec.rb | 5 | ||||
-rw-r--r-- | spec/integration/solo/solo_spec.rb | 5 | ||||
-rw-r--r-- | spec/unit/cookbook/synchronizer_spec.rb | 3 | ||||
-rw-r--r-- | spec/unit/environment_spec.rb | 2 |
6 files changed, 16 insertions, 12 deletions
diff --git a/spec/functional/event_loggers/windows_eventlog_spec.rb b/spec/functional/event_loggers/windows_eventlog_spec.rb index fa84e96c25..c1e5150428 100644 --- a/spec/functional/event_loggers/windows_eventlog_spec.rb +++ b/spec/functional/event_loggers/windows_eventlog_spec.rb @@ -49,7 +49,7 @@ describe Chef::EventLoggers::WindowsEventLogger, :windows_only do logger.run_start(version, run_status) expect(event_log.read(flags, offset).any? do |e| - e.source == "Chef" && e.event_id == 10000 && + e.source == Chef::Dist::PRODUCT && e.event_id == 10000 && e.string_inserts[0].include?(version) end).to be_truthy end @@ -57,7 +57,7 @@ describe Chef::EventLoggers::WindowsEventLogger, :windows_only do logger.run_started(run_status) expect(event_log.read(flags, offset).any? do |e| - e.source == "Chef" && e.event_id == 10001 && + e.source == Chef::Dist::PRODUCT && e.event_id == 10001 && e.string_inserts[0].include?(run_id) end).to be_truthy end @@ -66,7 +66,7 @@ describe Chef::EventLoggers::WindowsEventLogger, :windows_only do logger.run_completed(node) expect(event_log.read(flags, offset).any? do |e| - e.source == "Chef" && e.event_id == 10002 && + e.source == Chef::Dist::PRODUCT && e.event_id == 10002 && e.string_inserts[0].include?(run_id) && e.string_inserts[1].include?(elapsed_time.to_s) end).to be_truthy @@ -77,7 +77,7 @@ describe Chef::EventLoggers::WindowsEventLogger, :windows_only do logger.run_failed(mock_exception) expect(event_log.read(flags, offset).any? do |e| - e.source == "Chef" && e.event_id == 10003 && + e.source == Chef::Dist::PRODUCT && e.event_id == 10003 && e.string_inserts[0].include?(run_id) && e.string_inserts[1].include?(elapsed_time.to_s) && e.string_inserts[2].include?(mock_exception.class.name) && @@ -91,7 +91,7 @@ describe Chef::EventLoggers::WindowsEventLogger, :windows_only do logger.run_failed(mock_exception) expect(event_log.read(flags, offset).any? do |e| - e.source == "Chef" && e.event_id == 10003 && + e.source == Chef::Dist::PRODUCT && e.event_id == 10003 && e.string_inserts[0].include?("UNKNOWN") && e.string_inserts[1].include?("UNKNOWN") && e.string_inserts[2].include?(mock_exception.class.name) && diff --git a/spec/functional/version_spec.rb b/spec/functional/version_spec.rb index b12d235405..246b3a021a 100644 --- a/spec/functional/version_spec.rb +++ b/spec/functional/version_spec.rb @@ -19,12 +19,13 @@ require File.expand_path("../../spec_helper", __FILE__) require "chef/mixin/shell_out" require "chef/version" require "ohai/version" +require "chef/dist" describe "Chef Versions" do include Chef::Mixin::ShellOut let(:chef_dir) { File.join(File.dirname(__FILE__), "..", "..") } - binaries = [ "chef-client", "chef-shell", "chef-apply", "knife", "chef-solo" ] + binaries = [ Chef::Dist::CLIENT, "chef-shell", "chef-apply", "knife", Chef::Dist::SOLOEXEC ] binaries.each do |binary| it "#{binary} version should be sane" do diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb index cde25662c1..c2dc740025 100644 --- a/spec/integration/client/client_spec.rb +++ b/spec/integration/client/client_spec.rb @@ -2,6 +2,7 @@ require "support/shared/integration/integration_helper" require "chef/mixin/shell_out" require "tiny_server" require "tmpdir" +require "chef/dist" describe "chef-client" do @@ -45,8 +46,8 @@ describe "chef-client" do # machine that has omnibus chef installed. In that case we need to ensure # we're running `chef-client` from the source tree and not the external one. # cf. CHEF-4914 - let(:chef_client) { "bundle exec chef-client --minimal-ohai" } - let(:chef_solo) { "bundle exec chef-solo --legacy-mode --minimal-ohai" } + let(:chef_client) { "bundle exec #{Chef::Dist::CLIENT} --minimal-ohai" } + let(:chef_solo) { "bundle exec #{Chef::Dist::SOLOEXEC} --legacy-mode --minimal-ohai" } when_the_repository "has a cookbook with a no-op recipe" do before { file "cookbooks/x/recipes/default.rb", "" } diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb index 3d2efe703c..0d24269199 100644 --- a/spec/integration/solo/solo_spec.rb +++ b/spec/integration/solo/solo_spec.rb @@ -5,8 +5,9 @@ require "chef/config" require "timeout" require "fileutils" require "chef/win32/security" if Chef::Platform.windows? +require "chef/dist" -describe "chef-solo" do +describe Chef::Dist::SOLOEXEC do include IntegrationSupport include Chef::Mixin::ShellOut @@ -16,7 +17,7 @@ describe "chef-solo" do let(:cookbook_ancient_100_metadata_rb) { cb_metadata("ancient", "1.0.0") } - let(:chef_solo) { "bundle exec chef-solo --legacy-mode --minimal-ohai" } + let(:chef_solo) { "bundle exec #{Chef::Dist::SOLOEXEC} --legacy-mode --minimal-ohai" } when_the_repository "creates nodes" do let(:nodes_dir) { File.join(@repository_dir, "nodes") } diff --git a/spec/unit/cookbook/synchronizer_spec.rb b/spec/unit/cookbook/synchronizer_spec.rb index 1291b230c1..dc68bf1824 100644 --- a/spec/unit/cookbook/synchronizer_spec.rb +++ b/spec/unit/cookbook/synchronizer_spec.rb @@ -1,6 +1,7 @@ require "spec_helper" require "chef/cookbook/synchronizer" require "chef/cookbook_version" +require "chef/dist" describe Chef::CookbookCacheCleaner do describe "when cleaning up unused cookbook components" do @@ -49,7 +50,7 @@ describe Chef::CookbookCacheCleaner do cleaner.cleanup_file_cache end - it "does not remove anything on chef-solo" do + it "does not remove anything on #{Chef::Dist::SOLOEXEC}" do Chef::Config[:solo_legacy_mode] = true allow(cleaner.cache).to receive(:find).and_return(%w{cookbooks/valid1/recipes/default.rb cookbooks/valid2/recipes/default.rb}) expect(cleaner.cache).not_to receive(:delete) diff --git a/spec/unit/environment_spec.rb b/spec/unit/environment_spec.rb index 8103adc8fa..aa4c105c3a 100644 --- a/spec/unit/environment_spec.rb +++ b/spec/unit/environment_spec.rb @@ -299,7 +299,7 @@ describe Chef::Environment do expect do Chef::Environment.validate_cookbook_version("= 1.2.3.4") end.to raise_error Chef::Exceptions::IllegalVersionConstraint, - "Environment cookbook version constraints not allowed in chef-solo" + /Environment cookbook version constraints not allowed in .*/ end end |