summaryrefslogtreecommitdiff
path: root/spec/functional/resource
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2015-10-02 15:14:29 -0700
committerClaire McQuin <claire@getchef.com>2015-10-05 10:00:07 -0700
commite413ea35bba2ad36453b3d428c343ab3f0bce23a (patch)
tree2114f4b54a99337f67e66b46f7f172d49c6a5313 /spec/functional/resource
parent69cf21c8b35d7fb94775db377e810908e5fad54a (diff)
downloadchef-e413ea35bba2ad36453b3d428c343ab3f0bce23a.tar.gz
Raise error when running 32-bit scripts on Windows Nano.mcquin/nano/disable-32-bit
Diffstat (limited to 'spec/functional/resource')
-rw-r--r--spec/functional/resource/powershell_script_spec.rb17
1 files changed, 14 insertions, 3 deletions
diff --git a/spec/functional/resource/powershell_script_spec.rb b/spec/functional/resource/powershell_script_spec.rb
index ba0f867fcc..91b74fd752 100644
--- a/spec/functional/resource/powershell_script_spec.rb
+++ b/spec/functional/resource/powershell_script_spec.rb
@@ -314,9 +314,7 @@ configuration LCM
expect(source_contains_case_insensitive_content?( get_script_output, 'AMD64' )).to eq(true)
end
- it "executes a script with a 32-bit process if :i386 arch is specified" do
- pending "executing scripts with a 32-bit process should raise an error on nano" if Chef::Platform.windows_nano_server?
-
+ it "executes a script with a 32-bit process if :i386 arch is specified", :not_supported_on_nano do
resource.code(processor_architecture_script_content + " | out-file -encoding ASCII #{script_output_path}")
resource.architecture(:i386)
resource.returns(0)
@@ -324,6 +322,12 @@ configuration LCM
expect(source_contains_case_insensitive_content?( get_script_output, 'x86' )).to eq(true)
end
+
+ it "raises an error when executing a script with a 32-bit process on Windows Nano Server", :windows_nano_only do
+ resource.code(processor_architecture_script_content + " | out-file -encoding ASCII #{script_output_path}")
+ expect{ resource.architecture(:i386) }.to raise_error(Chef::Exceptions::Win32ArchitectureIncorrect,
+ "cannot execute script with requested architecture 'i386' on Windows Nano Server")
+ end
end
describe "when executing guards" do
@@ -577,6 +581,13 @@ configuration LCM
resource.not_if "$env:PROCESSOR_ARCHITECTURE -eq 'X86'"
expect(resource.should_skip?(:run)).to be_truthy
end
+
+ it "raises an error when a 32-bit guard is used on Windows Nano Server", :windows_nano_only do
+ resource.only_if "$true", :architecture => :i386
+ expect{resource.run_action(:run)}.to raise_error(
+ Chef::Exceptions::Win32ArchitectureIncorrect,
+ /cannot execute script with requested architecture 'i386' on Windows Nano Server/)
+ end
end
end