summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCrae <john.mccrae@progress.com>2022-01-04 14:58:17 -0800
committerJohn McCrae <john.mccrae@progress.com>2022-01-18 13:32:41 -0800
commit1cd4d22844e839c47eb6d3539c9fff66cd61461c (patch)
tree4e6ac9760601994d69c915078b8bca5fa97fc5a5
parent07b30a57f658035f992f12165dbe465857051592 (diff)
downloadchef-1cd4d22844e839c47eb6d3539c9fff66cd61461c.tar.gz
Updated the chef client to retrieve certs from the Windows registry. Tests included. This is PR3 since I keep trashing them
Signed-off-by: John McCrae <john.mccrae@progress.com>
-rw-r--r--spec/unit/platform/query_helpers_spec.rb70
1 files changed, 36 insertions, 34 deletions
diff --git a/spec/unit/platform/query_helpers_spec.rb b/spec/unit/platform/query_helpers_spec.rb
index 0b4169810e..a6190b1f3e 100644
--- a/spec/unit/platform/query_helpers_spec.rb
+++ b/spec/unit/platform/query_helpers_spec.rb
@@ -18,46 +18,48 @@
require "spec_helper"
-describe "Chef::Platform#supports_dsc_invoke_resource?" do
- it "returns false if powershell is not present" do
- node = Chef::Node.new
- expect(Chef::Platform.supports_dsc_invoke_resource?(node)).to be_falsey
- end
-
- ["1.0", "2.0", "3.0", "4.0", "5.0.10017.9"].each do |version|
- it "returns false for PowerShell #{version}" do
+if ChefUtils.Windows?
+ describe "Chef::Platform#supports_dsc_invoke_resource?" do
+ it "returns false if powershell is not present" do
node = Chef::Node.new
- node.automatic[:languages][:powershell][:version] = version
expect(Chef::Platform.supports_dsc_invoke_resource?(node)).to be_falsey
end
- end
- it "returns true for Powershell 5.0.10018.0" do
- node = Chef::Node.new
- node.automatic[:languages][:powershell][:version] = "5.0.10018.0"
- expect(Chef::Platform.supports_dsc_invoke_resource?(node)).to be_truthy
+ ["1.0", "2.0", "3.0", "4.0", "5.0.10017.9"].each do |version|
+ it "returns false for PowerShell #{version}" do
+ node = Chef::Node.new
+ node.automatic[:languages][:powershell][:version] = version
+ expect(Chef::Platform.supports_dsc_invoke_resource?(node)).to be_falsey
+ end
+ end
+
+ it "returns true for Powershell 5.0.10018.0" do
+ node = Chef::Node.new
+ node.automatic[:languages][:powershell][:version] = "5.0.10018.0"
+ expect(Chef::Platform.supports_dsc_invoke_resource?(node)).to be_truthy
+ end
end
-end
-describe "Chef::Platform#dsc_refresh_mode_disabled?" do
- let(:node) { instance_double("Chef::Node") }
- let(:powershell) { instance_double("Chef::PowerShell") }
+ describe "Chef::Platform#dsc_refresh_mode_disabled?" do
+ let(:node) { instance_double("Chef::Node") }
+ let(:powershell) { instance_double("Chef::PowerShell") }
- it "returns true when RefreshMode is Disabled" do
- expect(Chef::PowerShell).to receive(:new)
- .with("Get-DscLocalConfigurationManager")
- .and_return(powershell)
- expect(powershell).to receive(:error!)
- expect(powershell).to receive(:result).and_return({ "RefreshMode" => "Disabled" })
- expect(Chef::Platform.dsc_refresh_mode_disabled?(node)).to be true
- end
+ it "returns true when RefreshMode is Disabled" do
+ expect(Chef::PowerShell).to receive(:new)
+ .with("Get-DscLocalConfigurationManager")
+ .and_return(powershell)
+ expect(powershell).to receive(:error!)
+ expect(powershell).to receive(:result).and_return({ "RefreshMode" => "Disabled" })
+ expect(Chef::Platform.dsc_refresh_mode_disabled?(node)).to be true
+ end
- it "returns false when RefreshMode is not Disabled" do
- expect(Chef::PowerShell).to receive(:new)
- .with("Get-DscLocalConfigurationManager")
- .and_return(powershell)
- expect(powershell).to receive(:error!)
- expect(powershell).to receive(:result).and_return({ "RefreshMode" => "LaLaLa" })
- expect(Chef::Platform.dsc_refresh_mode_disabled?(node)).to be false
+ it "returns false when RefreshMode is not Disabled" do
+ expect(Chef::PowerShell).to receive(:new)
+ .with("Get-DscLocalConfigurationManager")
+ .and_return(powershell)
+ expect(powershell).to receive(:error!)
+ expect(powershell).to receive(:result).and_return({ "RefreshMode" => "LaLaLa" })
+ expect(Chef::Platform.dsc_refresh_mode_disabled?(node)).to be false
+ end
end
-end
+end \ No newline at end of file