summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-06-27 20:58:04 -0700
committerTim Smith <tsmith@chef.io>2018-06-27 20:58:04 -0700
commit23982962e8063853a755ce758c50620c73500b1b (patch)
tree647c7da6bc9c13fa608c0940e82868d72daea699
parentcb90ed45d4e8afa4e5899222a78b201e1d967a53 (diff)
downloadohai-23982962e8063853a755ce758c50620c73500b1b.tar.gz
Add tests for Amazon Linux 2 detection
Past and current string tests Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--spec/unit/plugins/linux/platform_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/unit/plugins/linux/platform_spec.rb b/spec/unit/plugins/linux/platform_spec.rb
index 88f5dacc..42e94e00 100644
--- a/spec/unit/plugins/linux/platform_spec.rb
+++ b/spec/unit/plugins/linux/platform_spec.rb
@@ -458,6 +458,22 @@ OS_RELEASE
expect(@plugin[:platform_version].to_f).to eq(7.3)
end
+ it "should read the platform as amazon and version as 2 on the RC release" do
+ expect(File).to receive(:read).with("/etc/redhat-release").and_return("Amazon Linux release 2 (2017.12) LTS Release Candidate")
+ @plugin.run
+ expect(@plugin[:platform]).to eq("amazon")
+ expect(@plugin[:platform_family]).to eq("amazon")
+ expect(@plugin[:platform_version].to_f).to eq(2)
+ end
+
+ it "should read the platform as amazon and version as 2 on the final release" do
+ expect(File).to receive(:read).with("/etc/redhat-release").and_return("Amazon Linux 2")
+ @plugin.run
+ expect(@plugin[:platform]).to eq("amazon")
+ expect(@plugin[:platform_family]).to eq("amazon")
+ expect(@plugin[:platform_version].to_f).to eq(2)
+ end
+
# https://github.com/chef/ohai/issues/560
# Issue is seen on EL7, so that's what we're testing.
context "on versions that have /etc/os-release" do