spec/unit/plugins/linux/platform_spec.rb in ohai-14.6.2 vs spec/unit/plugins/linux/platform_spec.rb in ohai-14.8.10
- old
+ new
@@ -294,22 +294,24 @@
end
end
describe "on arista eos" do
+ let(:have_system_release) { true }
+ let(:have_redhat_release) { true }
let(:have_eos_release) { true }
before(:each) do
@plugin.lsb = nil
end
it "should set platform to arista_eos" do
- expect(File).to receive(:read).with("/etc/Eos-release").and_return("Arista Networks EOS 4.16.7M")
+ expect(File).to receive(:read).with("/etc/Eos-release").and_return("Arista Networks EOS 4.21.1.1F")
@plugin.run
expect(@plugin[:platform]).to eq("arista_eos")
expect(@plugin[:platform_family]).to eq("fedora")
- expect(@plugin[:platform_version]).to eq("4.16.7M")
+ expect(@plugin[:platform_version]).to eq("4.21.1.1F")
end
end
describe "on f5 big-ip" do
@@ -699,13 +701,44 @@
end
end
end
describe "on suse" do
+ context "on openSUSE 15+" do
- context "on versions that have /etc/os-release and no /etc/SuSE-release (e.g. SLES15)" do
+ let(:have_suse_release) { false }
+ let(:have_os_release) { true }
+ let(:os_release_content) do
+ <<~OS_RELEASE
+ NAME="openSUSE Leap"
+ VERSION="15.0"
+ ID="opensuse-leap"
+ ID_LIKE="suse opensuse"
+ VERSION_ID="15.0"
+ PRETTY_NAME="openSUSE Leap 15.0"
+ ANSI_COLOR="0;32"
+ CPE_NAME="cpe:/o:opensuse:leap:15.0"
+OS_RELEASE
+ end
+
+ before do
+ expect(File).to_not receive(:read).with("/etc/SuSE-release")
+ expect(File).to receive(:read).with("/etc/os-release").and_return(os_release_content)
+ end
+
+ it "correctly detects opensuseleap 15" do
+ @plugin.run
+ expect(@plugin[:platform]).to eq("opensuseleap")
+ expect(@plugin[:platform_version]).to eq("15.0")
+ expect(@plugin[:platform_family]).to eq("suse")
+ end
+
+ end
+
+ context "on SLES 15+" do
+
let(:have_suse_release) { false }
let(:have_os_release) { true }
let(:os_release_content) do
<<~OS_RELEASE
@@ -730,10 +763,9 @@
@plugin.run
expect(@plugin[:platform]).to eq("suse")
expect(@plugin[:platform_version]).to eq("15")
expect(@plugin[:platform_family]).to eq("suse")
end
-
end
context "on versions that have both /etc/os-release and /etc/SuSE-release (e.g. SLES12)" do
let(:have_suse_release) { true }
let(:have_os_release) { true }