From 44aae2c29d0c4ba28b4dbfc8c638036d8a2663ec Mon Sep 17 00:00:00 2001 From: Marc Chamberland Date: Sun, 5 May 2019 18:55:51 -0400 Subject: distro constants for solo, zero and automate Signed-off-by: Marc Chamberland --- spec/functional/version_spec.rb | 3 ++- spec/integration/client/client_spec.rb | 5 +++-- spec/integration/solo/solo_spec.rb | 5 +++-- spec/unit/cookbook/synchronizer_spec.rb | 3 ++- spec/unit/environment_spec.rb | 2 +- spec/unit/policy_builder/policyfile_spec.rb | 2 +- 6 files changed, 12 insertions(+), 8 deletions(-) (limited to 'spec') 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 1841707c2d..07d8f5f552 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 diff --git a/spec/unit/policy_builder/policyfile_spec.rb b/spec/unit/policy_builder/policyfile_spec.rb index f22e2a74b3..1293d6ebc6 100644 --- a/spec/unit/policy_builder/policyfile_spec.rb +++ b/spec/unit/policy_builder/policyfile_spec.rb @@ -150,7 +150,7 @@ describe Chef::PolicyBuilder::Policyfile do expect(initialize_pb.temporary_policy?).to be_falsey end - context "chef-solo" do + context "#{Chef::Dist::SOLOEXEC}" do before { Chef::Config[:solo_legacy_mode] = true } it "errors on create" do -- cgit v1.2.1