spec/unit/plugins/linux/platform_spec.rb in ohai-8.18.0 vs spec/unit/plugins/linux/platform_spec.rb in ohai-8.19.0

- old
+ new

@@ -24,10 +24,11 @@ let(:have_debian_version) { false } let(:have_redhat_release) { false } let(:have_gentoo_release) { false } let(:have_exherbo_release) { false } let(:have_alpine_release) { false } + let(:have_eos_release) { false } let(:have_suse_release) { false } let(:have_arch_release) { false } let(:have_system_release) { false } let(:have_slackware_version) { false } let(:have_enterprise_release) { false } @@ -44,10 +45,11 @@ allow(File).to receive(:exist?).with("/etc/debian_version").and_return(have_debian_version) allow(File).to receive(:exist?).with("/etc/redhat-release").and_return(have_redhat_release) allow(File).to receive(:exist?).with("/etc/gentoo-release").and_return(have_gentoo_release) allow(File).to receive(:exist?).with("/etc/exherbo-release").and_return(have_exherbo_release) allow(File).to receive(:exist?).with("/etc/alpine-release").and_return(have_alpine_release) + allow(File).to receive(:exist?).with("/etc/Eos-release").and_return(have_eos_release) allow(File).to receive(:exist?).with("/etc/SuSE-release").and_return(have_suse_release) allow(File).to receive(:exist?).with("/etc/arch-release").and_return(have_arch_release) allow(File).to receive(:exist?).with("/etc/system-release").and_return(have_system_release) allow(File).to receive(:exist?).with("/etc/slackware-version").and_return(have_slackware_version) allow(File).to receive(:exist?).with("/etc/enterprise-release").and_return(have_enterprise_release) @@ -241,9 +243,26 @@ expect(File).to receive(:read).with("/etc/alpine-release").and_return("3.2.3") @plugin.run expect(@plugin[:platform]).to eq("alpine") expect(@plugin[:platform_family]).to eq("alpine") expect(@plugin[:platform_version]).to eq("3.2.3") + end + end + + describe "on arista eos" do + + 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") + @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 exherbo" do