summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-02-27 12:28:01 -0800
committerTim Smith <tsmith@chef.io>2018-02-27 12:28:01 -0800
commitf1bb7801b8ab42b0e2c838f1e65495fc563b5f60 (patch)
treebbf779cef9e35f4beb0ad1e6eec70cc16c92c0d7
parente3dfe501fc3d7193fc052bdbf336629f7a6d3f89 (diff)
downloadohai-f1bb7801b8ab42b0e2c838f1e65495fc563b5f60.tar.gz
Fix specs failures in the scaleway plugin
Make sure we mock out the /proc/cmdline so we don't fail on non-Linux systems and properly expect an empty hash when we're on scaleway, but metadata fetching fails Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/ohai/plugins/scaleway.rb1
-rw-r--r--spec/unit/plugins/scaleway_spec.rb3
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/ohai/plugins/scaleway.rb b/lib/ohai/plugins/scaleway.rb
index 5cfd1079..9dbc925f 100644
--- a/lib/ohai/plugins/scaleway.rb
+++ b/lib/ohai/plugins/scaleway.rb
@@ -51,7 +51,6 @@ Ohai.plugin(:Scaleway) do
end
else
Ohai::Log.debug("Plugin Scaleway: No hints present for and doesn't look like scaleway")
- false
end
end
end
diff --git a/spec/unit/plugins/scaleway_spec.rb b/spec/unit/plugins/scaleway_spec.rb
index 8352e9f7..1296b3d7 100644
--- a/spec/unit/plugins/scaleway_spec.rb
+++ b/spec/unit/plugins/scaleway_spec.rb
@@ -22,6 +22,7 @@ describe Ohai::System, "plugin scaleway" do
before(:each) do
allow(plugin).to receive(:hint?).with("scaleway").and_return(false)
+ allow(File).to receive(:read).with("/proc/cmdline").and_return(false)
end
shared_examples_for "!scaleway" do
@@ -64,7 +65,7 @@ describe Ohai::System, "plugin scaleway" do
and_return(double("Net::HTTP Response", :body => "", :code => "404"))
plugin.run
- expect(plugin[:scaleway]).to be_nil
+ expect(plugin[:scaleway]).not_to be_nil
end
end