summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan McLellan <btm@loftninjas.org>2020-04-06 14:25:52 -0400
committerBryan McLellan <btm@loftninjas.org>2020-04-06 19:35:42 -0400
commit5e66323f6beba2acbb7dfc860e46dfd5a70e44ea (patch)
tree41531d4a1c9a887790f48f4a00150b18188a53c3
parentd6eecc5c8af421ba2665a8f24f618b6bf95e195d (diff)
downloadchef-5e66323f6beba2acbb7dfc860e46dfd5a70e44ea.tar.gz
Really skip the reboot pending func test if a reboot is pending
This looks like it never worked but we happened to never run into it until we added a desktop platform to the pipeline. Signed-off-by: Bryan McLellan <btm@loftninjas.org>
-rw-r--r--spec/functional/dsl/reboot_pending_spec.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/spec/functional/dsl/reboot_pending_spec.rb b/spec/functional/dsl/reboot_pending_spec.rb
index 89701802b3..09f587a1bc 100644
--- a/spec/functional/dsl/reboot_pending_spec.rb
+++ b/spec/functional/dsl/reboot_pending_spec.rb
@@ -17,10 +17,13 @@
#
require "chef/dsl/reboot_pending"
+require "chef/dsl/registry_helper"
require "chef/win32/registry"
require "spec_helper"
describe Chef::DSL::RebootPending, :windows_only do
+ include Chef::DSL::RegistryHelper
+
def run_ohai
node.consume_external_attrs(OHAI_SYSTEM.data, {})
end
@@ -36,10 +39,6 @@ describe Chef::DSL::RebootPending, :windows_only do
let(:reg_key) { nil }
let(:original_set) { false }
- before(:all) { @any_flag = {} }
-
- after { @any_flag[reg_key] = original_set }
-
describe 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations' do
let(:reg_key) { 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager' }
let(:original_set) { registry.value_exists?(reg_key, { name: "PendingFileRenameOperations" }) }
@@ -79,7 +78,9 @@ describe Chef::DSL::RebootPending, :windows_only do
describe "when there is nothing to indicate a reboot is pending" do
it "should return false" do
- skip "reboot pending" if @any_flag.any? { |_, v| v == true }
+ skip "reboot pending" if 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\RebootPending')
expect(recipe.reboot_pending?).to be_falsey
end
end