summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2021-01-12 18:59:56 -0800
committerGitHub <noreply@github.com>2021-01-12 18:59:56 -0800
commitd18c3a9222cf4802804d2122270dc6d223d2b403 (patch)
treeaf36e1273f9f4b0516e628fcb518623a1ac0da3c
parent5750f3218ccd8bb6750234e7acadcb33a738f7de (diff)
parentc258deb0d3e0e9a1adcfd3b2c78cafea654c91fb (diff)
downloadchef-d18c3a9222cf4802804d2122270dc6d223d2b403.tar.gz
Merge pull request #10874 from chef/lcg/fix-ohai-resource-spec
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--spec/functional/resource/ohai_spec.rb12
-rw-r--r--spec/spec_helper.rb2
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