spec/unit/plugins/linux/platform_spec.rb in ohai-13.2.0 vs spec/unit/plugins/linux/platform_spec.rb in ohai-13.3.0

- old
+ new

@@ -35,10 +35,11 @@ let(:have_parallels_release) { false } let(:have_raspi_config) { false } let(:have_os_release) { false } let(:have_usr_lib_os_release) { false } let(:have_cisco_release) { false } + let(:have_f5_release) { false } let(:have_cumulus_dir) { false } before(:each) do @plugin = get_plugin("linux/platform") allow(@plugin).to receive(:collect_os).and_return(:linux) @@ -56,10 +57,11 @@ allow(File).to receive(:exist?).with("/etc/enterprise-release").and_return(have_enterprise_release) allow(File).to receive(:exist?).with("/etc/oracle-release").and_return(have_oracle_release) allow(File).to receive(:exist?).with("/etc/parallels-release").and_return(have_parallels_release) allow(File).to receive(:exist?).with("/usr/bin/raspi-config").and_return(have_raspi_config) allow(File).to receive(:exist?).with("/etc/os-release").and_return(have_os_release) + allow(File).to receive(:exist?).with("/etc/f5-release").and_return(have_f5_release) allow(File).to receive(:exist?).with("/usr/lib/os-release").and_return(have_usr_lib_os_release) allow(File).to receive(:exist?).with("/etc/shared/os-release").and_return(have_cisco_release) allow(Dir).to receive(:exist?).with("/etc/cumulus").and_return(have_cumulus_dir) allow(File).to receive(:read).with("PLEASE STUB ALL File.read CALLS") @@ -304,9 +306,26 @@ expect(File).to receive(:read).with("/etc/Eos-release").and_return("Arista Networks EOS 4.16.7M") @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") + end + end + + describe "on f5 big-ip" do + + let(:have_f5_release) { true } + + before(:each) do + @plugin.lsb = nil + end + + it "should set platform to bigip" do + expect(File).to receive(:read).with("/etc/f5-release").and_return("BIG-IP release 13.0.0 (Final)") + @plugin.run + expect(@plugin[:platform]).to eq("bigip") + expect(@plugin[:platform_family]).to eq("rhel") + expect(@plugin[:platform_version]).to eq("13.0.0") end end describe "on exherbo" do