diff options
author | Tim Smith <tsmith@chef.io> | 2020-10-28 21:40:40 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-28 21:40:40 -0700 |
commit | 04d1726d95987988d33d919740ce806501c28268 (patch) | |
tree | ecd5cc5cafbf17ddf8370aafd53fb96de5bcaeea | |
parent | e2d118e65c273a869a81dd02fb1e497ecd68f167 (diff) | |
parent | bb1ff247cb8549bebadcd36df82b2a062ee4ec40 (diff) | |
download | ohai-04d1726d95987988d33d919740ce806501c28268.tar.gz |
Merge pull request #1543 from chef/omnios
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | spec/unit/plugins/solaris2/platform_spec.rb | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/spec/unit/plugins/solaris2/platform_spec.rb b/spec/unit/plugins/solaris2/platform_spec.rb index 03e34782..08bbec74 100644 --- a/spec/unit/plugins/solaris2/platform_spec.rb +++ b/spec/unit/plugins/solaris2/platform_spec.rb @@ -46,20 +46,18 @@ describe Ohai::System, "Solaris plugin platform" do @release = StringIO.new(" SmartOS 20120130T201844Z x86_64\n") allow(File).to receive(:open).with("/etc/release").and_yield(@release) + @plugin.run end it "runs uname and set platform and build" do - @plugin.run expect(@plugin[:platform_build]).to eq("joyent_20120130T201844Z") end it "sets the platform" do - @plugin.run expect(@plugin[:platform]).to eq("smartos") end it "sets the platform_version" do - @plugin.run expect(@plugin[:platform_version]).to eq("5.11") end @@ -86,23 +84,59 @@ describe Ohai::System, "Solaris plugin platform" do @release = StringIO.new(" Oracle Solaris 11.1 X86\n") allow(File).to receive(:open).with("/etc/release").and_yield(@release) + @plugin.run end it "runs uname and set platform and build" do - @plugin.run expect(@plugin[:platform_build]).to eq("11.1") end it "sets the platform" do - @plugin.run expect(@plugin[:platform]).to eq("solaris2") end it "sets the platform_version" do - @plugin.run expect(@plugin[:platform_version]).to eq("5.11") end end + describe "on OmniOS" do + before do + @uname_x = <<~UNAME_X + System = SunOS + Node = omniosce-vagrant + Release = 5.11 + KernelID = omnios-r151026-673c59f55d + Machine = i86pc + BusType = <unknown> + Serial = <unknown> + Users = <unknown> + OEM# = 0 + Origin# = 1 + NumCPU = 1 + UNAME_X + + allow(File).to receive(:exist?).with("/sbin/uname").and_return(true) + allow(@plugin).to receive(:shell_out).with("/sbin/uname -X").and_return(mock_shell_out(0, @uname_x, "")) + + @release = StringIO.new(" OmniOS v11 r151026\n Copyright 2017 OmniTI Computer Consulting, Inc. All rights reserved.\n Copyright 2018 OmniOS Community Edition (OmniOSce) Association.\n All rights reserved. Use is subject to licence terms.") + allow(File).to receive(:open).with("/etc/release").and_yield(@release) + @plugin.run + end + + it "runs uname and set platform and build" do + expect(@plugin[:platform_build]).to eq("omnios-r151026-673c59f55d") + end + + it "sets the platform" do + expect(@plugin[:platform]).to eq("omnios") + end + + it "sets the platform_version" do + expect(@plugin[:platform_version]).to eq("151026") + end + + end + end |