diff options
author | Thom May <thom@chef.io> | 2015-04-30 14:48:50 +0100 |
---|---|---|
committer | Thom May <thom@chef.io> | 2015-04-30 14:48:50 +0100 |
commit | 02c42d02db528b5ba1dcfdc39d8cb096c9bc6d03 (patch) | |
tree | 472bf5074a2f040b6abf885220c344c99f07dbfd | |
parent | 9ae9edbc2233af73e846bfdba8029b87ab3d63d6 (diff) | |
download | chef-02c42d02db528b5ba1dcfdc39d8cb096c9bc6d03.tar.gz |
Mark all functional reboot tests as pending
We can't safely run these tests right now as they look at the state of
the system registry, which often needs a reboot. The guards don't
appear to work correctly.
-rw-r--r-- | spec/functional/dsl/reboot_pending_spec.rb | 106 |
1 files changed, 54 insertions, 52 deletions
diff --git a/spec/functional/dsl/reboot_pending_spec.rb b/spec/functional/dsl/reboot_pending_spec.rb index 125c952a55..7eb11e0e0b 100644 --- a/spec/functional/dsl/reboot_pending_spec.rb +++ b/spec/functional/dsl/reboot_pending_spec.rb @@ -32,9 +32,9 @@ describe Chef::DSL::RebootPending, :windows_only do 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\WindowsUpdate\Auto Update\RebootRequired') registry.key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootRequired') || - registry.key_exists?('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile') + registry.key_exists?('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile') end let(:node) { Chef::Node.new } @@ -44,76 +44,78 @@ describe Chef::DSL::RebootPending, :windows_only do let(:recipe) { Chef::Recipe.new("a windows cookbook", "the windows recipe", run_context) } let(:registry) { Chef::Win32::Registry.new(run_context) } - describe "reboot_pending?" do + pending "Can't safely test Registry entries" do + describe "reboot_pending?" do - describe "when there is nothing to indicate a reboot is pending" do - it "should return false" do - pending "Found existing registry keys" if registry_unsafe? - expect(recipe.reboot_pending?).to be_false + describe "when there is nothing to indicate a reboot is pending" do + it "should return false" do + pending "Found existing registry keys" if registry_unsafe? + expect(recipe.reboot_pending?).to be_false + end 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" if registry_unsafe? - registry.set_value('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', - { :name => 'PendingFileRenameOperations', :type => :multi_string, :data => ['\??\C:\foo.txt|\??\C:\bar.txt'] }) + describe 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations' do + it "returns true if the registry value exists" do + 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 + expect(recipe.reboot_pending?).to be_true + end - after do - unless registry_unsafe? - registry.delete_value('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', { :name => 'PendingFileRenameOperations' }) + after do + unless registry_unsafe? + registry.delete_value('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', { :name => 'PendingFileRenameOperations' }) + end end end - end - 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" if registry_unsafe? - registry.create_key('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired', false) + 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" if registry_unsafe? + registry.create_key('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired', false) - expect(recipe.reboot_pending?).to be_true - end + expect(recipe.reboot_pending?).to be_true + end - after do - unless registry_unsafe? - registry.delete_key('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired', false) + after do + unless registry_unsafe? + registry.delete_key('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired', false) + end end end - end - 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" if registry_unsafe? - registry.create_key('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootRequired', false) + 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" if registry_unsafe? + registry.create_key('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootRequired', false) - expect(recipe.reboot_pending?).to be_true - end + expect(recipe.reboot_pending?).to be_true + end - after do - unless registry_unsafe? - registry.delete_key('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootRequired', false) + after do + unless registry_unsafe? + registry.delete_key('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootRequired', false) + end end end - end - describe 'HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile\Flags' do - it "returns true if the registry key exists" do - 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 }) + describe 'HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile\Flags' do + it "returns true if the registry key exists" do + 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 }) - expect(recipe.reboot_pending?).to be_true - end + expect(recipe.reboot_pending?).to be_true + end - after do - unless registry_unsafe? - registry.delete_value('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile', { :name => 'Flags' }) - registry.delete_key('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile', false) + after do + unless registry_unsafe? + registry.delete_value('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile', { :name => 'Flags' }) + registry.delete_key('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile', false) + end end end end |