diff options
author | Tim Smith <tsmith@chef.io> | 2021-01-19 20:43:31 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-19 20:43:31 -0800 |
commit | 1e33db8ad7888a64a54fce73db76197d78108ea4 (patch) | |
tree | f5902efccd9017b6482c4eb0242a4a0ac48f2f59 | |
parent | 2b28e57bdd2f0b9b5712e242526300c41310878e (diff) | |
parent | 55142153a9b391173abd6f96a032b9b213d0663f (diff) | |
download | chef-1e33db8ad7888a64a54fce73db76197d78108ea4.tar.gz |
Merge pull request #10897 from chef/ohai_16
Fix ohai resource spec
-rw-r--r-- | spec/functional/resource/ohai_spec.rb | 12 | ||||
-rw-r--r-- | spec/spec_helper.rb | 2 |
2 files changed, 3 insertions, 11 deletions
diff --git a/spec/functional/resource/ohai_spec.rb b/spec/functional/resource/ohai_spec.rb index 836a4f6da3..3d6caca088 100644 --- a/spec/functional/resource/ohai_spec.rb +++ b/spec/functional/resource/ohai_spec.rb @@ -19,10 +19,6 @@ require "spec_helper" describe Chef::Resource::Ohai do - let(:ohai) do - OHAI_SYSTEM - end - let(:node) { Chef::Node.new } let(:run_context) do @@ -34,13 +30,9 @@ describe Chef::Resource::Ohai do shared_examples_for "reloaded :uptime" do it "should reload :uptime" do - initial_uptime = ohai[:uptime] - - # Sleep for a second so the uptime gets updated. - sleep 1 - + expect(node[:uptime_seconds]).to be nil ohai_resource.run_action(:reload) - expect(node[:uptime]).not_to eq(initial_uptime) + expect(Integer(node[:uptime_seconds])).to be_an(Integer) end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 17ce1ab5b7..52f17788bb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -87,7 +87,7 @@ Dir["spec/support/**/*.rb"] .each { |f| require f } OHAI_SYSTEM = Ohai::System.new -OHAI_SYSTEM.all_plugins(["platform", "hostname", "languages/powershell"]) +OHAI_SYSTEM.all_plugins(["platform", "hostname", "languages/powershell", "uptime"]) test_node = Chef::Node.new test_node.automatic["os"] = (OHAI_SYSTEM["os"] || "unknown_os").dup.freeze |