summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerdar Sutay <serdar@opscode.com>2014-10-28 15:43:29 -0700
committerJay Mundrawala <jdmundrawala@gmail.com>2015-04-27 09:35:35 -0700
commite43cef5f1cc9a0b8a57a6419e2ba440c4de0a487 (patch)
tree545a662761a34b48eeb3bcb0f8651fd999c65733
parentda7986e436271912272f21b45fd47881a237f5b0 (diff)
downloadchef-e43cef5f1cc9a0b8a57a6419e2ba440c4de0a487.tar.gz
Fix the logic that checks for existing reboot pending in reboot pending tests.
-rw-r--r--spec/functional/dsl/reboot_pending_spec.rb30
1 files changed, 15 insertions, 15 deletions
diff --git a/spec/functional/dsl/reboot_pending_spec.rb b/spec/functional/dsl/reboot_pending_spec.rb
index 114754ccba..f6bbb5296c 100644
--- a/spec/functional/dsl/reboot_pending_spec.rb
+++ b/spec/functional/dsl/reboot_pending_spec.rb
@@ -30,11 +30,11 @@ describe Chef::DSL::RebootPending, :windows_only do
ohai
end
- def registry_safe?
- !registry.value_exists?('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', { :name => 'PendingFileRenameOperations' }) ||
- !registry.key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired') ||
- !registry.key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootRequired') ||
- !registry.key_exists?('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile')
+ def registry_unsafe?
+ registry.value_exists?('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', { :name => 'PendingFileRenameOperations' }) ||
+ registry.key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired')
+ registry.key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootRequired') ||
+ registry.key_exists?('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile')
end
let(:node) { Chef::Node.new }
@@ -48,22 +48,22 @@ describe Chef::DSL::RebootPending, :windows_only do
describe "when there is nothing to indicate a reboot is pending" do
it "should return false" do
- pending "Found existing registry keys" unless registry_safe?
+ pending "Found existing registry keys" if registry_unsafe?
expect(recipe.reboot_pending?).to be_false
end
end
describe 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations' do
it "returns true if the registry value exists" do
- pending "Found existing registry keys" unless registry_safe?
- registry.set_value('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager',
+ pending "Found existing registry keys" if registry_unsafe?
+ registry.set_value('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager',
{ :name => 'PendingFileRenameOperations', :type => :multi_string, :data => ['\??\C:\foo.txt|\??\C:\bar.txt'] })
expect(recipe.reboot_pending?).to be_true
end
after do
- if registry_safe?
+ if registry_unsafe?
registry.delete_value('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', { :name => 'PendingFileRenameOperations' })
end
end
@@ -71,14 +71,14 @@ describe Chef::DSL::RebootPending, :windows_only do
describe 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired' do
it "returns true if the registry key exists" do
- pending "Found existing registry keys" unless registry_safe?
+ pending "Found existing registry keys" if registry_unsafe?
registry.create_key('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired', false)
expect(recipe.reboot_pending?).to be_true
end
after do
- if registry_safe?
+ if registry_unsafe?
registry.delete_key('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired', false)
end
end
@@ -87,14 +87,14 @@ describe Chef::DSL::RebootPending, :windows_only do
describe 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootRequired' do
it "returns true if the registry key exists" do
pending "Permissions are limited to 'TrustedInstaller' by default"
- pending "Found existing registry keys" unless registry_safe?
+ pending "Found existing registry keys" if registry_unsafe?
registry.create_key('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootRequired', false)
expect(recipe.reboot_pending?).to be_true
end
after do
- if registry_safe?
+ if registry_unsafe?
registry.delete_key('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootRequired', false)
end
end
@@ -102,7 +102,7 @@ describe Chef::DSL::RebootPending, :windows_only do
describe 'HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile\Flags' do
it "returns true if the registry key exists" do
- pending "Found existing registry keys" unless registry_safe?
+ pending "Found existing registry keys" if registry_unsafe?
registry.create_key('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile', true)
registry.set_value('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile',
{ :name => 'Flags', :type => :dword, :data => 3 })
@@ -111,7 +111,7 @@ describe Chef::DSL::RebootPending, :windows_only do
end
after do
- if registry_safe?
+ if registry_unsafe?
registry.delete_value('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile', { :name => 'Flags' })
registry.delete_key('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile', false)
end