spec/unit/plugins/linux/platform_spec.rb in ohai-8.8.1 vs spec/unit/plugins/linux/platform_spec.rb in ohai-8.9.0
- old
+ new
@@ -1,8 +1,8 @@
#
# Author:: Adam Jacob (<adam@chef.io>)
-# Copyright:: Copyright (c) 2008-2015 Chef Software, Inc.
+# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -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_suse_release) { false }
let(:have_arch_release) { false }
let(:have_system_release) { false }
let(:have_slackware_version) { false }
let(:have_enterprise_release) { false }
@@ -43,10 +44,11 @@
@plugin[:lsb] = Mash.new
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/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)
@@ -218,9 +220,26 @@
it "should set platform and platform_family to gentoo" do
expect(File).to receive(:read).with("/etc/gentoo-release").and_return("Gentoo Base System release 1.20.1.1")
@plugin.run
expect(@plugin[:platform]).to eq("gentoo")
expect(@plugin[:platform_family]).to eq("gentoo")
+ end
+ end
+
+ describe "on alpine" do
+
+ let(:have_alpine_release) { true }
+
+ before(:each) do
+ @plugin.lsb = nil
+ end
+
+ it "should set platform and platform_family to alpine" do
+ 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 exherbo" do